home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Games / Mac Game Developer's Handbook / Graphics / Principia Off-Screen < prev    next >
MacBinary  |  1993-04-22  |  436.4 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Thu Apr 22 00:56:30 1993, modified Thu Apr 22 00:57:02 1993, creator 'HLX2', type 'ONLN', 437955 bytes "Principia Off-Screen" , at 0x6af43 8678 bytes resource default (weak)
99% file data default
66% TrID raw Group 3 FAX bitmap default (weak)
33% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 14 50 72 69 6e 63 69 | 70 69 61 20 4f 66 66 2d |..Princi|pia Off-|
|00000010| 53 63 72 65 65 6e 00 00 | 00 00 00 00 00 00 00 00 |Screen..|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 06 ae c3 00 | 00 21 e6 a7 fb d5 fe a7 |........|.!......|
|00000060| fb d6 1e 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 0d ca 00 00 |........|........|
|00000080| 50 72 69 6e 63 69 70 69 | 61 20 4f 66 66 2d 53 63 |Principi|a Off-Sc|
|00000090| 72 65 65 6e 20 47 72 61 | 70 68 69 63 73 20 45 6e |reen Gra|phics En|
|000000a0| 76 69 72 6f 6e 6d 65 6e | 74 73 0d 49 6d 61 67 69 |vironmen|ts.Imagi|
|000000b0| 6e 67 09 4d 2e 49 4d 2e | 50 72 69 6e 63 69 70 69 |ng.M.IM.|Principi|
|000000c0| 61 4f 66 66 53 63 72 65 | 65 6e 0d 55 70 64 61 74 |aOffScre|en.Updat|
|000000d0| 65 64 20 62 79 3a 09 46 | 6f 72 72 65 73 74 20 54 |ed by:.F|orrest T|
|000000e0| 61 6e 61 6b 61 09 4d 61 | 72 63 68 20 31 39 39 32 |anaka.Ma|rch 1992|
|000000f0| 0d 57 72 69 74 74 65 6e | 20 62 79 3a 09 46 6f 72 |.Written| by:.For|
|00000100| 72 65 73 74 20 54 61 6e | 61 6b 61 09 4f 63 74 6f |rest Tan|aka.Octo|
|00000110| 62 65 72 20 31 39 39 31 | 0d 49 6e 73 70 69 72 65 |ber 1991|.Inspire|
|00000120| 64 20 62 79 3a 09 4a 69 | 6d 20 46 72 69 65 64 6c |d by:.Ji|m Friedl|
|00000130| 61 6e 64 65 72 2c 20 52 | 69 63 6b 20 42 6c 61 69 |ander, R|ick Blai|
|00000140| 72 2c 20 61 6e 64 20 52 | 69 63 68 20 43 6f 6c 6c |r, and R|ich Coll|
|00000150| 79 65 72 0d 55 73 69 6e | 67 20 43 6f 6c 6f 72 20 |yer.Usin|g Color |
|00000160| 51 75 69 63 6b 44 72 61 | 77 20 74 6f 20 64 72 61 |QuickDra|w to dra|
|00000170| 77 20 6f 66 66 20 73 63 | 72 65 65 6e 20 69 73 20 |w off sc|reen is |
|00000180| 61 20 63 6f 6d 6d 6f 6e | 20 72 65 71 75 69 72 65 |a common| require|
|00000190| 6d 65 6e 74 20 6f 66 20 | 61 70 70 6c 69 63 61 74 |ment of |applicat|
|000001a0| 69 6f 6e 73 20 61 6e 64 | 20 6f 74 68 65 72 20 6b |ions and| other k|
|000001b0| 69 6e 64 73 20 6f 66 20 | 70 72 6f 67 72 61 6d 73 |inds of |programs|
|000001c0| 20 74 68 61 74 20 72 75 | 6e 20 6f 6e 20 74 68 65 | that ru|n on the|
|000001d0| 20 4d 61 63 69 6e 74 6f | 73 68 2e 20 54 68 69 73 | Macinto|sh. This|
|000001e0| 20 4e 6f 74 65 20 64 69 | 73 63 75 73 73 65 73 20 | Note di|scusses |
|000001f0| 77 68 61 74 20 43 6f 6c | 6f 72 20 51 75 69 63 6b |what Col|or Quick|
|00000200| 44 72 61 77 20 6e 65 65 | 64 73 20 69 6e 20 61 20 |Draw nee|ds in a |
|00000210| 67 72 61 70 68 69 63 73 | 20 65 6e 76 69 72 6f 6e |graphics| environ|
|00000220| 6d 65 6e 74 20 61 6e 64 | 20 68 6f 77 20 74 6f 20 |ment and| how to |
|00000230| 63 72 65 61 74 65 20 6f | 6e 65 20 66 6f 72 20 6f |create o|ne for o|
|00000240| 66 66 2d 73 63 72 65 65 | 6e 20 64 72 61 77 69 6e |ff-scree|n drawin|
|00000250| 67 2e 20 41 20 62 72 69 | 65 66 20 64 69 73 63 75 |g. A bri|ef discu|
|00000260| 73 73 69 6f 6e 20 6f 66 | 20 47 57 6f 72 6c 64 73 |ssion of| GWorlds|
|00000270| 2c 20 77 68 69 63 68 20 | 61 72 65 20 6f 66 66 2d |, which |are off-|
|00000280| 73 63 72 65 65 6e 20 67 | 72 61 70 68 69 63 73 20 |screen g|raphics |
|00000290| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 73 20 74 68 61 |environm|ents tha|
|000002a0| 74 20 61 72 65 20 73 65 | 74 20 75 70 20 62 79 20 |t are se|t up by |
|000002b0| 74 68 65 20 73 79 73 74 | 65 6d 2c 20 69 73 20 67 |the syst|em, is g|
|000002c0| 69 76 65 6e 20 74 6f 20 | 68 65 6c 70 20 79 6f 75 |iven to |help you|
|000002d0| 20 64 65 63 69 64 65 20 | 77 68 65 74 68 65 72 20 | decide |whether |
|000002e0| 74 6f 20 75 73 65 20 74 | 68 65 6d 20 6f 72 20 74 |to use t|hem or t|
|000002f0| 68 65 20 64 6f 2d 69 74 | 2d 79 6f 75 72 73 65 6c |he do-it|-yoursel|
|00000300| 66 20 74 65 63 68 6e 69 | 71 75 65 73 20 64 65 73 |f techni|ques des|
|00000310| 63 72 69 62 65 64 20 69 | 6e 20 74 68 69 73 20 4e |cribed i|n this N|
|00000320| 6f 74 65 20 66 6f 72 20 | 73 65 74 74 69 6e 67 20 |ote for |setting |
|00000330| 75 70 20 61 6e 20 6f 66 | 66 2d 73 63 72 65 65 6e |up an of|f-screen|
|00000340| 20 67 72 61 70 68 69 63 | 73 20 65 6e 76 69 72 6f | graphic|s enviro|
|00000350| 6e 6d 65 6e 74 2e 20 54 | 68 65 20 61 75 74 68 6f |nment. T|he autho|
|00000360| 72 d5 73 20 69 6e 74 65 | 6e 74 20 69 73 20 74 6f |r.s inte|nt is to|
|00000370| 20 70 72 6f 76 69 64 65 | 20 63 6f 6e 63 65 70 74 | provide| concept|
|00000380| 73 20 61 6e 64 20 72 6f | 75 74 69 6e 65 73 20 66 |s and ro|utines f|
|00000390| 6f 72 20 63 72 65 61 74 | 69 6e 67 20 61 6e 20 6f |or creat|ing an o|
|000003a0| 66 66 2d 73 63 72 65 65 | 6e 20 67 72 61 70 68 69 |ff-scree|n graphi|
|000003b0| 63 73 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 2c 20 |cs envir|onment, |
|000003c0| 61 6e 64 20 61 6c 73 6f | 20 74 6f 20 65 78 70 6c |and also| to expl|
|000003d0| 61 69 6e 20 77 68 79 20 | 65 78 69 73 74 69 6e 67 |ain why |existing|
|000003e0| 20 72 6f 75 74 69 6e 65 | 73 20 66 6f 72 20 6f 66 | routine|s for of|
|000003f0| 66 2d 73 63 72 65 65 6e | 20 64 72 61 77 69 6e 67 |f-screen| drawing|
|00000400| 20 61 63 74 20 61 73 20 | 74 68 65 79 20 64 6f 2e | act as |they do.|
|00000410| 0d 4d 61 6e 79 2c 20 6d | 61 6e 79 20 74 68 61 6e |.Many, m|any than|
|00000420| 6b 73 20 67 6f 20 74 6f | 20 47 75 69 6c 6c 65 72 |ks go to| Guiller|
|00000430| 6d 6f 20 4f 72 74 69 7a | 2c 20 4b 6f 6e 73 74 61 |mo Ortiz|, Konsta|
|00000440| 6e 74 69 6e 20 4f 74 68 | 6d 65 72 2c 20 42 72 75 |ntin Oth|mer, Bru|
|00000450| 63 65 20 4c 65 61 6b 2c | 20 61 6e 64 20 4a 6f 6e |ce Leak,| and Jon|
|00000460| 20 5a 61 70 20 66 6f 72 | 20 61 6c 6c 20 74 68 65 | Zap for| all the|
|00000470| 69 72 20 65 78 70 65 72 | 74 69 73 65 20 6f 6e 20 |ir exper|tise on |
|00000480| 74 68 69 73 20 73 75 62 | 6a 65 63 74 2c 20 52 69 |this sub|ject, Ri|
|00000490| 63 68 20 43 6f 6c 6c 79 | 65 72 2c 20 52 69 63 6b |ch Colly|er, Rick|
|000004a0| 20 42 6c 61 69 72 2c 20 | 61 6e 64 20 4a 69 6d 20 | Blair, |and Jim |
|000004b0| 46 72 69 65 64 6c 61 6e | 64 65 72 20 66 6f 72 20 |Friedlan|der for |
|000004c0| 70 61 76 69 6e 67 20 74 | 68 65 20 77 61 79 2c 20 |paving t|he way, |
|000004d0| 61 6e 64 20 65 73 70 65 | 63 69 61 6c 6c 79 20 74 |and espe|cially t|
|000004e0| 6f 20 61 6c 6c 20 70 65 | 6f 70 6c 65 20 77 68 6f |o all pe|ople who|
|000004f0| 20 69 6e 73 70 69 72 65 | 64 20 74 68 69 73 20 75 | inspire|d this u|
|00000500| 70 64 61 74 65 20 62 79 | 20 61 73 6b 69 6e 67 20 |pdate by| asking |
|00000510| 67 72 65 61 74 20 6f 66 | 66 2d 73 63 72 65 65 6e |great of|f-screen|
|00000520| 20 64 72 61 77 69 6e 67 | 20 71 75 65 73 74 69 6f | drawing| questio|
|00000530| 6e 73 2e 0d 43 68 61 6e | 67 65 73 20 73 69 6e 63 |ns..Chan|ges sinc|
|00000540| 65 20 4f 63 74 6f 62 65 | 72 20 31 39 39 31 3a 20 |e Octobe|r 1991: |
|00000550| 20 41 20 76 65 72 79 20 | 65 6d 62 61 72 72 61 73 | A very |embarras|
|00000560| 73 69 6e 67 20 62 75 67 | 20 77 61 73 20 66 6f 75 |sing bug| was fou|
|00000570| 6e 64 20 69 6e 20 43 72 | 65 61 74 65 4f 66 66 53 |nd in Cr|eateOffS|
|00000580| 63 72 65 65 6e 20 61 6e | 64 20 55 70 64 61 74 65 |creen an|d Update|
|00000590| 4f 66 66 53 63 72 65 65 | 6e 2e 20 49 66 20 79 6f |OffScree|n. If yo|
|000005a0| 75 20 74 72 79 20 74 6f | 20 63 72 65 61 74 65 20 |u try to| create |
|000005b0| 61 20 31 36 2d 20 6f 72 | 20 33 32 2d 62 69 74 20 |a 16- or| 32-bit |
|000005c0| 6f 66 66 2d 73 63 72 65 | 65 6e 20 67 72 61 70 68 |off-scre|en graph|
|000005d0| 69 63 73 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2c |ics envi|ronment,|
|000005e0| 20 79 6f 75 d5 6c 6c 20 | 6a 75 73 74 20 67 65 74 | you.ll |just get|
|000005f0| 20 61 20 70 61 72 61 6d | 45 72 72 2e 20 49 74 20 | a param|Err. It |
|00000600| 77 6f 6e d5 74 20 64 6f | 20 74 68 61 74 20 6e 6f |won.t do| that no|
|00000610| 77 2e 0d 4f 66 66 2d 53 | 63 72 65 65 6e 69 6e 67 |w..Off-S|creening|
|00000620| 0d 54 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 2c 20 |.The Mac|intosh, |
|00000630| 61 73 20 77 69 74 68 20 | 65 76 65 72 79 20 6f 74 |as with |every ot|
|00000640| 68 65 72 20 43 50 55 20 | 65 76 65 72 20 6d 61 64 |her CPU |ever mad|
|00000650| 65 20 62 79 20 41 70 70 | 6c 65 2c 20 68 61 73 20 |e by App|le, has |
|00000660| 6d 65 6d 6f 72 79 2d 6d | 61 70 70 65 64 20 76 69 |memory-m|apped vi|
|00000670| 64 65 6f 2e 20 54 68 61 | 74 20 69 73 2c 20 77 68 |deo. Tha|t is, wh|
|00000680| 61 74 20 79 6f 75 20 73 | 65 65 20 6f 6e 20 74 68 |at you s|ee on th|
|00000690| 65 20 73 63 72 65 65 6e | 20 69 73 20 6a 75 73 74 |e screen| is just|
|000006a0| 20 74 68 65 20 76 69 73 | 75 61 6c 20 72 65 70 72 | the vis|ual repr|
|000006b0| 65 73 65 6e 74 61 74 69 | 6f 6e 20 6f 66 20 61 20 |esentati|on of a |
|000006c0| 70 61 72 74 20 6f 66 20 | 6d 65 6d 6f 72 79 20 74 |part of |memory t|
|000006d0| 68 61 74 d5 73 20 72 65 | 73 65 72 76 65 64 20 66 |hat.s re|served f|
|000006e0| 6f 72 20 74 68 65 20 76 | 69 64 65 6f 20 68 61 72 |or the v|ideo har|
|000006f0| 64 77 61 72 65 20 28 74 | 68 61 74 d5 73 20 73 74 |dware (t|hat.s st|
|00000700| 72 65 74 63 68 69 6e 67 | 20 74 68 65 20 74 72 75 |retching| the tru|
|00000710| 74 68 20 6a 75 73 74 20 | 61 20 62 69 74 20 69 6e |th just |a bit in|
|00000720| 20 74 68 65 20 63 61 73 | 65 20 6f 66 20 74 68 65 | the cas|e of the|
|00000730| 20 74 65 78 74 20 73 63 | 72 65 65 6e 73 20 6f 66 | text sc|reens of|
|00000740| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 41 70 | the ori|ginal Ap|
|00000750| 70 6c 65 20 63 6f 6d 70 | 75 74 65 72 2c 20 74 68 |ple comp|uter, th|
|00000760| 65 20 41 70 70 6c 65 20 | 49 49 20 6c 69 6e 65 2c |e Apple |II line,|
|00000770| 20 61 6e 64 20 74 68 65 | 20 41 70 70 6c 65 20 49 | and the| Apple I|
|00000780| 49 49 20 62 65 63 61 75 | 73 65 20 74 68 65 72 65 |II becau|se there|
|00000790| d5 73 20 61 6c 73 6f 20 | 61 20 63 68 61 72 61 63 |.s also |a charac|
|000007a0| 74 65 72 20 67 65 6e 65 | 72 61 74 6f 72 20 69 6e |ter gene|rator in|
|000007b0| 20 74 68 6f 73 65 2c 20 | 62 75 74 20 74 68 65 20 | those, |but the |
|000007c0| 6f 76 65 72 61 6c 6c 20 | 70 72 6f 63 65 73 73 20 |overall |process |
|000007d0| 73 74 69 6c 6c 20 6c 6f | 6f 6b 73 20 72 6f 75 67 |still lo|oks roug|
|000007e0| 68 6c 79 20 74 68 65 20 | 73 61 6d 65 29 2e 20 49 |hly the |same). I|
|000007f0| 66 20 79 6f 75 20 63 68 | 61 6e 67 65 20 74 68 65 |f you ch|ange the|
|00000800| 20 63 6f 6e 74 65 6e 74 | 73 20 6f 66 20 61 20 6d | content|s of a m|
|00000810| 65 6d 6f 72 79 20 6c 6f | 63 61 74 69 6f 6e 20 69 |emory lo|cation i|
|00000820| 6e 20 74 68 69 73 20 70 | 61 72 74 20 6f 66 20 6d |n this p|art of m|
|00000830| 65 6d 6f 72 79 2c 20 74 | 68 65 6e 20 79 6f 75 d5 |emory, t|hen you.|
|00000840| 6c 6c 20 73 65 65 20 74 | 68 65 20 63 6f 72 72 65 |ll see t|he corre|
|00000850| 73 70 6f 6e 64 69 6e 67 | 20 6c 6f 63 61 74 69 6f |sponding| locatio|
|00000860| 6e 20 6f 6e 20 74 68 65 | 20 73 63 72 65 65 6e 20 |n on the| screen |
|00000870| 63 68 61 6e 67 65 20 77 | 68 65 6e 20 74 68 65 20 |change w|hen the |
|00000880| 76 69 64 65 6f 20 68 61 | 72 64 77 61 72 65 20 64 |video ha|rdware d|
|00000890| 72 61 77 73 20 74 68 65 | 20 6e 65 78 74 20 66 72 |raws the| next fr|
|000008a0| 61 6d 65 20 6f 72 20 66 | 69 65 6c 64 20 6f 66 20 |ame or f|ield of |
|000008b0| 76 69 64 65 6f 2e 20 54 | 68 65 20 72 65 73 69 64 |video. T|he resid|
|000008c0| 65 6e 74 20 72 61 73 74 | 65 72 20 67 72 61 70 68 |ent rast|er graph|
|000008d0| 69 63 73 20 70 61 63 6b | 61 67 65 2c 20 51 75 69 |ics pack|age, Qui|
|000008e0| 63 6b 44 72 61 77 20 69 | 6e 20 74 68 65 20 63 61 |ckDraw i|n the ca|
|000008f0| 73 65 20 6f 66 20 74 68 | 65 20 4d 61 63 69 6e 74 |se of th|e Macint|
|00000900| 6f 73 68 2c 20 64 72 61 | 77 73 20 69 6d 61 67 65 |osh, dra|ws image|
|00000910| 73 20 62 79 20 73 74 75 | 66 66 69 6e 67 20 74 68 |s by stu|ffing th|
|00000920| 65 20 72 69 67 68 74 20 | 76 61 6c 75 65 73 20 69 |e right |values i|
|00000930| 6e 74 6f 20 74 68 65 20 | 72 69 67 68 74 20 70 6c |nto the |right pl|
|00000940| 61 63 65 73 20 69 6e 20 | 74 68 65 20 70 61 72 74 |aces in |the part|
|00000950| 20 6f 66 20 6d 65 6d 6f | 72 79 20 72 65 73 65 72 | of memo|ry reser|
|00000960| 76 65 64 20 66 6f 72 20 | 74 68 65 20 76 69 64 65 |ved for |the vide|
|00000970| 6f 20 64 69 73 70 6c 61 | 79 2e 20 54 68 65 20 72 |o displa|y. The r|
|00000980| 65 73 75 6c 74 69 6e 67 | 20 69 6d 61 67 65 20 6f |esulting| image o|
|00000990| 6e 20 74 68 65 20 73 63 | 72 65 65 6e 20 6c 6f 6f |n the sc|reen loo|
|000009a0| 6b 73 20 6c 69 6b 65 20 | 61 20 6c 69 6e 65 20 6f |ks like |a line o|
|000009b0| 72 20 70 65 72 68 61 70 | 73 20 61 6e 20 6f 76 61 |r perhap|s an ova|
|000009c0| 6c 20 69 66 20 79 6f 75 | 20 61 73 6b 65 64 20 51 |l if you| asked Q|
|000009d0| 75 69 63 6b 44 72 61 77 | 20 74 6f 20 64 72 61 77 |uickDraw| to draw|
|000009e0| 20 61 20 6c 69 6e 65 20 | 6f 72 20 61 6e 20 6f 76 | a line |or an ov|
|000009f0| 61 6c 2c 20 6f 72 20 69 | 74 20 63 6f 75 6c 64 20 |al, or i|t could |
|00000a00| 62 65 20 61 6e 20 65 6e | 74 69 72 65 20 63 6f 6d |be an en|tire com|
|00000a10| 70 6c 65 78 20 69 6d 61 | 67 65 20 69 66 20 79 6f |plex ima|ge if yo|
|00000a20| 75 20 61 73 6b 65 64 20 | 51 75 69 63 6b 44 72 61 |u asked |QuickDra|
|00000a30| 77 20 74 6f 20 64 72 61 | 77 20 6f 6e 65 2e 20 54 |w to dra|w one. T|
|00000a40| 68 69 73 20 69 73 20 6e | 6f 72 6d 61 6c 2c 20 6f |his is n|ormal, o|
|00000a50| 6e 2d 73 63 72 65 65 6e | 20 64 72 61 77 69 6e 67 |n-screen| drawing|
|00000a60| 2e 0d 42 65 63 61 75 73 | 65 20 76 69 64 65 6f 20 |..Becaus|e video |
|00000a70| 6d 65 6d 6f 72 79 20 69 | 73 20 61 20 70 61 72 74 |memory i|s a part|
|00000a80| 20 6f 66 20 52 41 4d 20 | 6a 75 73 74 20 6c 69 6b | of RAM |just lik|
|00000a90| 65 20 61 6e 79 20 6f 74 | 68 65 72 20 70 61 72 74 |e any ot|her part|
|00000aa0| 20 6f 66 20 52 41 4d 20 | 69 6e 20 74 68 65 20 6d | of RAM |in the m|
|00000ab0| 65 6d 6f 72 79 20 6d 61 | 70 20 6f 66 20 74 68 65 |emory ma|p of the|
|00000ac0| 20 4d 61 63 69 6e 74 6f | 73 68 20 28 6f 72 20 61 | Macinto|sh (or a|
|00000ad0| 6c 6d 6f 73 74 20 6c 69 | 6b 65 3b 20 76 69 64 65 |lmost li|ke; vide|
|00000ae0| 6f 20 6d 65 6d 6f 72 79 | 20 6d 69 67 68 74 20 65 |o memory| might e|
|00000af0| 78 69 73 74 20 6f 6e 20 | 61 20 4e 75 42 75 73 aa |xist on |a NuBus.|
|00000b00| 20 76 69 64 65 6f 20 63 | 61 72 64 2c 20 62 75 74 | video c|ard, but|
|00000b10| 20 69 74 d5 73 20 73 74 | 69 6c 6c 20 52 41 4d 29 | it.s st|ill RAM)|
|00000b20| 2c 20 51 75 69 63 6b 44 | 72 61 77 20 63 61 6e 20 |, QuickD|raw can |
|00000b30| 62 65 20 74 6f 6c 64 20 | 74 6f 20 64 72 61 77 20 |be told |to draw |
|00000b40| 69 6e 74 6f 20 61 20 70 | 61 72 74 20 6f 66 20 6d |into a p|art of m|
|00000b50| 65 6d 6f 72 79 20 74 68 | 61 74 20 69 73 6e d5 74 |emory th|at isn.t|
|00000b60| 20 72 65 73 65 72 76 65 | 64 20 66 6f 72 20 74 68 | reserve|d for th|
|00000b70| 65 20 76 69 64 65 6f 20 | 68 61 72 64 77 61 72 65 |e video |hardware|
|00000b80| 2c 20 6d 61 79 62 65 20 | 69 6e 74 6f 20 61 20 70 |, maybe |into a p|
|00000b90| 61 72 74 20 6f 66 20 79 | 6f 75 72 20 6f 77 6e 20 |art of y|our own |
|00000ba0| 61 70 70 6c 69 63 61 74 | 69 6f 6e d5 73 20 68 65 |applicat|ion.s he|
|00000bb0| 61 70 2e 20 57 68 65 6e | 20 79 6f 75 20 74 65 6c |ap. When| you tel|
|00000bc0| 6c 20 51 75 69 63 6b 44 | 72 61 77 20 74 6f 20 64 |l QuickD|raw to d|
|00000bd0| 72 61 77 20 69 6e 74 6f | 20 61 20 70 61 72 74 20 |raw into| a part |
|00000be0| 6f 66 20 6d 65 6d 6f 72 | 79 20 74 68 61 74 d5 73 |of memor|y that.s|
|00000bf0| 20 6e 6f 74 20 72 65 73 | 65 72 76 65 64 20 66 6f | not res|erved fo|
|00000c00| 72 20 74 68 65 20 76 69 | 64 65 6f 20 68 61 72 64 |r the vi|deo hard|
|00000c10| 77 61 72 65 2c 20 79 6f | 75 20 63 61 6e d5 74 20 |ware, yo|u can.t |
|00000c20| 73 65 65 20 61 6e 79 20 | 6f 66 20 74 68 65 20 72 |see any |of the r|
|00000c30| 65 73 75 6c 74 73 2e 20 | 54 68 69 73 20 69 73 20 |esults. |This is |
|00000c40| 6f 66 66 2d 73 63 72 65 | 65 6e 20 64 72 61 77 69 |off-scre|en drawi|
|00000c50| 6e 67 2e 20 54 68 65 72 | 65 20 61 72 65 20 70 6c |ng. Ther|e are pl|
|00000c60| 65 6e 74 79 20 6f 66 20 | 70 65 72 66 65 63 74 6c |enty of |perfectl|
|00000c70| 79 20 67 6f 6f 64 20 72 | 65 61 73 6f 6e 73 20 74 |y good r|easons t|
|00000c80| 6f 20 64 6f 20 74 68 69 | 73 2c 20 73 75 63 68 20 |o do thi|s, such |
|00000c90| 61 73 20 70 72 6f 76 69 | 64 69 6e 67 20 73 74 6f |as provi|ding sto|
|00000ca0| 72 61 67 65 20 66 6f 72 | 20 61 20 70 61 69 6e 74 |rage for| a paint|
|00000cb0| 2d 73 74 79 6c 65 20 64 | 6f 63 75 6d 65 6e 74 20 |-style d|ocument |
|00000cc0| 6f 72 20 74 6f 20 73 6d | 6f 6f 74 68 6c 79 20 61 |or to sm|oothly a|
|00000cd0| 6e 69 6d 61 74 65 20 61 | 6e 20 69 6d 61 67 65 2c |nimate a|n image,|
|00000ce0| 20 62 75 74 20 74 68 65 | 20 61 73 73 75 6d 70 74 | but the| assumpt|
|00000cf0| 69 6f 6e 20 68 65 72 65 | 20 69 73 20 74 68 61 74 |ion here| is that|
|00000d00| 20 79 6f 75 20 68 61 76 | 65 20 61 20 70 65 72 66 | you hav|e a perf|
|00000d10| 65 63 74 6c 79 20 67 6f | 6f 64 20 72 65 61 73 6f |ectly go|od reaso|
|00000d20| 6e 20 74 6f 20 64 6f 20 | 74 68 69 73 20 73 6f 20 |n to do |this so |
|00000d30| 79 6f 75 d5 72 65 20 6d | 6f 72 65 20 69 6e 74 65 |you.re m|ore inte|
|00000d40| 72 65 73 74 65 64 20 69 | 6e 20 74 68 65 20 d2 68 |rested i|n the .h|
|00000d50| 6f 77 d3 20 6f 66 20 69 | 74 20 69 6e 73 74 65 61 |ow. of i|t instea|
|00000d60| 64 20 6f 66 20 74 68 65 | 20 d2 77 68 79 d3 20 6f |d of the| .why. o|
|00000d70| 66 20 69 74 2e 20 49 66 | 20 79 6f 75 20 6e 65 65 |f it. If| you nee|
|00000d80| 64 20 74 6f 20 6b 6e 6f | 77 20 77 68 79 2c 20 74 |d to kno|w why, t|
|00000d90| 68 65 72 65 20 61 72 65 | 20 73 65 76 65 72 61 6c |here are| several|
|00000da0| 20 62 6f 6f 6b 73 20 74 | 68 61 74 20 63 6f 76 65 | books t|hat cove|
|00000db0| 72 20 6f 66 66 2d 73 63 | 72 65 65 6e 20 64 72 61 |r off-sc|reen dra|
|00000dc0| 77 69 6e 67 20 61 6e 64 | 20 74 68 65 20 70 65 72 |wing and| the per|
|00000dd0| 66 65 63 74 6c 79 20 67 | 6f 6f 64 20 72 65 61 73 |fectly g|ood reas|
|00000de0| 6f 6e 73 20 74 6f 20 64 | 6f 20 73 75 63 68 20 61 |ons to d|o such a|
|00000df0| 20 74 68 69 6e 67 2e 20 | 41 20 67 6f 6f 64 20 70 | thing. |A good p|
|00000e00| 6c 61 63 65 20 74 6f 20 | 73 74 61 72 74 20 69 73 |lace to |start is|
|00000e10| 20 53 63 6f 74 74 20 4b | 6e 61 73 74 65 72 d5 73 | Scott K|naster.s|
|00000e20| 20 62 6f 6f 6b 2c 20 4d | 61 63 69 6e 74 6f 73 68 | book, M|acintosh|
|00000e30| 20 50 72 6f 67 72 61 6d | 6d 69 6e 67 20 53 65 63 | Program|ming Sec|
|00000e40| 72 65 74 73 2c 20 72 65 | 66 65 72 65 6e 63 65 64 |rets, re|ferenced|
|00000e50| 20 61 74 20 74 68 65 20 | 65 6e 64 20 6f 66 20 74 | at the |end of t|
|00000e60| 68 69 73 20 4e 6f 74 65 | 2e 0d 54 68 69 73 20 4e |his Note|..This N|
|00000e70| 6f 74 65 20 69 73 20 64 | 69 76 69 64 65 64 20 69 |ote is d|ivided i|
|00000e80| 6e 74 6f 20 74 68 65 73 | 65 20 6d 61 6a 6f 72 20 |nto thes|e major |
|00000e90| 73 65 63 74 69 6f 6e 73 | 3a 0d a5 20 54 68 65 20 |sections|:.. The |
|00000ea0| 69 6e 74 72 6f 64 75 63 | 74 69 6f 6e 20 69 73 20 |introduc|tion is |
|00000eb0| 74 68 65 20 70 61 72 74 | 20 74 68 61 74 20 79 6f |the part| that yo|
|00000ec0| 75 d5 72 65 20 72 65 61 | 64 69 6e 67 20 6e 6f 77 |u.re rea|ding now|
|00000ed0| 2e 0d a5 20 d2 54 68 65 | 20 42 75 69 6c 64 69 6e |... .The| Buildin|
|00000ee0| 67 20 42 6c 6f 63 6b 73 | d3 20 70 72 6f 76 69 64 |g Blocks|. provid|
|00000ef0| 65 73 20 61 6e 20 6f 76 | 65 72 76 69 65 77 20 6f |es an ov|erview o|
|00000f00| 66 20 74 68 65 20 64 61 | 74 61 20 73 74 72 75 63 |f the da|ta struc|
|00000f10| 74 75 72 65 73 20 74 68 | 61 74 20 79 6f 75 20 6e |tures th|at you n|
|00000f20| 65 65 64 20 74 6f 20 74 | 65 6c 6c 20 43 6f 6c 6f |eed to t|ell Colo|
|00000f30| 72 20 51 75 69 63 6b 44 | 72 61 77 20 74 6f 20 64 |r QuickD|raw to d|
|00000f40| 72 61 77 20 6f 66 66 20 | 73 63 72 65 65 6e 2e 0d |raw off |screen..|
|00000f50| a5 20 d2 42 75 69 6c 64 | 69 6e 67 20 74 68 65 20 |. .Build|ing the |
|00000f60| 42 6c 6f 63 6b 73 d3 20 | 64 69 73 63 75 73 73 65 |Blocks. |discusse|
|00000f70| 73 20 74 68 65 20 63 6f | 6e 73 74 72 75 63 74 69 |s the co|nstructi|
|00000f80| 6f 6e 20 61 6e 64 20 69 | 6e 69 74 69 61 6c 69 7a |on and i|nitializ|
|00000f90| 61 74 69 6f 6e 20 6f 66 | 20 74 68 65 73 65 20 64 |ation of| these d|
|00000fa0| 61 74 61 20 73 74 72 75 | 63 74 75 72 65 73 2e 0d |ata stru|ctures..|
|00000fb0| a5 09 d2 50 6c 61 79 69 | 6e 67 20 57 69 74 68 20 |...Playi|ng With |
|00000fc0| 42 6c 6f 63 6b 73 d3 20 | 73 68 6f 77 73 20 61 6e |Blocks. |shows an|
|00000fd0| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 74 68 65 20 | example| of the |
|00000fe0| 75 73 65 20 6f 66 20 74 | 68 65 73 65 20 73 74 72 |use of t|hese str|
|00000ff0| 75 63 74 75 72 65 73 20 | 74 6f 20 64 72 61 77 20 |uctures |to draw |
|00001000| 6f 66 66 20 73 63 72 65 | 65 6e 2e 0d a5 09 d2 50 |off scre|en.....P|
|00001010| 75 74 20 54 68 61 74 20 | 43 68 65 63 6b 62 6f 6f |ut That |Checkboo|
|00001020| 6b 20 41 77 61 79 21 d3 | 20 64 69 73 63 75 73 73 |k Away!.| discuss|
|00001030| 65 73 20 73 6f 6d 65 20 | 76 61 72 69 61 74 69 6f |es some |variatio|
|00001040| 6e 73 20 6f 66 20 74 68 | 65 73 65 20 74 65 63 68 |ns of th|ese tech|
|00001050| 6e 69 71 75 65 73 20 74 | 6f 20 68 61 6e 64 6c 65 |niques t|o handle|
|00001060| 20 6f 66 66 2d 73 63 72 | 65 65 6e 20 64 72 61 77 | off-scr|een draw|
|00001070| 69 6e 67 20 66 6f 72 20 | 73 70 65 63 69 61 6c 20 |ing for |special |
|00001080| 63 61 73 65 73 2e 0d a5 | 09 d2 54 68 65 20 47 57 |cases...|..The GW|
|00001090| 6f 72 6c 64 20 46 61 63 | 74 6f 72 d3 20 70 72 6f |orld Fac|tor. pro|
|000010a0| 76 69 64 65 73 20 61 20 | 62 72 69 65 66 20 6f 76 |vides a |brief ov|
|000010b0| 65 72 76 69 65 77 20 6f | 66 20 47 57 6f 72 6c 64 |erview o|f GWorld|
|000010c0| 73 2c 20 68 6f 77 20 74 | 6f 20 75 73 65 20 74 68 |s, how t|o use th|
|000010d0| 65 6d 2c 20 61 6e 64 20 | 68 6f 77 20 74 68 65 79 |em, and |how they|
|000010e0| 20 63 6f 6d 70 61 72 65 | 20 61 6e 64 20 63 6f 6e | compare| and con|
|000010f0| 74 72 61 73 74 20 74 6f | 20 74 68 65 20 6d 61 6e |trast to| the man|
|00001100| 75 61 6c 20 74 65 63 68 | 6e 69 71 75 65 73 20 74 |ual tech|niques t|
|00001110| 68 61 74 20 61 72 65 20 | 64 65 73 63 72 69 62 65 |hat are |describe|
|00001120| 64 20 69 6e 20 6d 6f 73 | 74 20 6f 66 20 74 68 69 |d in mos|t of thi|
|00001130| 73 20 4e 6f 74 65 2e 0d | 54 68 6f 73 65 20 6f 66 |s Note..|Those of|
|00001140| 20 79 6f 75 20 77 68 6f | 20 61 72 65 6e d5 74 20 | you who| aren.t |
|00001150| 71 75 69 74 65 20 73 75 | 72 65 20 77 68 65 74 68 |quite su|re wheth|
|00001160| 65 72 20 74 6f 20 75 73 | 65 20 47 57 6f 72 6c 64 |er to us|e GWorld|
|00001170| 73 20 6f 72 20 74 68 65 | 20 64 6f 2d 69 74 2d 79 |s or the| do-it-y|
|00001180| 6f 75 72 73 65 6c 66 20 | 74 65 63 68 6e 69 71 75 |ourself |techniqu|
|00001190| 65 73 20 6d 69 67 68 74 | 20 77 61 6e 74 20 74 6f |es might| want to|
|000011a0| 20 73 6b 69 70 20 61 68 | 65 61 64 20 66 6f 72 20 | skip ah|ead for |
|000011b0| 61 20 6d 6f 6d 65 6e 74 | 20 74 6f 20 d2 54 68 65 |a moment| to .The|
|000011c0| 20 47 57 6f 72 6c 64 20 | 46 61 63 74 6f 72 d3 20 | GWorld |Factor. |
|000011d0| 6a 75 73 74 20 69 6e 20 | 63 61 73 65 20 64 6f 69 |just in |case doi|
|000011e0| 6e 67 20 69 74 20 79 6f | 75 72 73 65 6c 66 20 69 |ng it yo|urself i|
|000011f0| 73 20 61 20 77 61 73 74 | 65 20 6f 66 20 74 69 6d |s a wast|e of tim|
|00001200| 65 2e 20 49 6e 20 61 6e | 79 20 63 61 73 65 2c 20 |e. In an|y case, |
|00001210| 69 74 d5 73 20 61 20 67 | 6f 6f 64 20 69 64 65 61 |it.s a g|ood idea|
|00001220| 20 74 6f 20 72 65 61 64 | 20 74 68 69 73 20 77 68 | to read| this wh|
|00001230| 6f 6c 65 20 4e 6f 74 65 | 20 62 65 63 61 75 73 65 |ole Note| because|
|00001240| 20 74 68 65 20 63 6f 6e | 63 65 70 74 73 20 61 72 | the con|cepts ar|
|00001250| 65 20 6d 6f 73 74 6c 79 | 20 74 68 65 20 73 61 6d |e mostly| the sam|
|00001260| 65 20 77 68 65 74 68 65 | 72 20 79 6f 75 d5 72 65 |e whethe|r you.re|
|00001270| 20 75 73 69 6e 67 20 47 | 57 6f 72 6c 64 73 20 6f | using G|Worlds o|
|00001280| 72 20 6e 6f 74 2e 20 47 | 57 6f 72 6c 64 73 20 6a |r not. G|Worlds j|
|00001290| 75 73 74 20 6d 61 6b 65 | 20 74 68 65 20 70 72 6f |ust make| the pro|
|000012a0| 63 65 73 73 20 61 20 6c | 6f 74 20 65 61 73 69 65 |cess a l|ot easie|
|000012b0| 72 2c 20 61 6e 64 20 74 | 68 65 79 20 6c 65 74 20 |r, and t|hey let |
|000012c0| 79 6f 75 20 74 61 6b 65 | 20 61 64 76 61 6e 74 61 |you take| advanta|
|000012d0| 67 65 20 6f 66 20 74 68 | 65 20 38 a5 32 34 20 47 |ge of th|e 8.24 G|
|000012e0| 43 20 76 69 64 65 6f 20 | 63 61 72 64 2e 20 42 75 |C video |card. Bu|
|000012f0| 74 2c 20 77 65 d5 72 65 | 20 6e 6f 74 20 69 6e 20 |t, we.re| not in |
|00001300| 74 68 61 74 20 73 65 63 | 74 69 6f 6e 20 6f 66 20 |that sec|tion of |
|00001310| 74 68 65 20 4e 6f 74 65 | 20 79 65 74 2e 0d 54 68 |the Note| yet..Th|
|00001320| 65 20 42 75 69 6c 64 69 | 6e 67 20 42 6c 6f 63 6b |e Buildi|ng Block|
|00001330| 73 0d 42 65 66 6f 72 65 | 20 79 6f 75 20 63 61 6e |s.Before| you can|
|00001340| 20 74 65 6c 6c 20 51 75 | 69 63 6b 44 72 61 77 20 | tell Qu|ickDraw |
|00001350| 74 6f 20 64 72 61 77 20 | 6f 66 66 20 6f 66 20 74 |to draw |off of t|
|00001360| 68 65 20 73 63 72 65 65 | 6e 2c 20 79 6f 75 d5 6c |he scree|n, you.l|
|00001370| 6c 20 6e 65 65 64 20 74 | 6f 20 62 75 69 6c 64 20 |l need t|o build |
|00001380| 74 68 72 65 65 20 6d 61 | 6a 6f 72 20 64 61 74 61 |three ma|jor data|
|00001390| 20 73 74 72 75 63 74 75 | 72 65 73 3a 20 61 20 43 | structu|res: a C|
|000013a0| 47 72 61 66 50 6f 72 74 | 2c 20 61 20 50 69 78 4d |GrafPort|, a PixM|
|000013b0| 61 70 2c 20 61 6e 64 20 | 61 20 47 44 65 76 69 63 |ap, and |a GDevic|
|000013c0| 65 2e 20 59 6f 75 d5 6c | 6c 20 61 6c 73 6f 20 6e |e. You.l|l also n|
|000013d0| 65 65 64 20 61 20 63 6f | 75 70 6c 65 20 6f 66 20 |eed a co|uple of |
|000013e0| 74 61 62 6c 65 73 20 74 | 68 61 74 20 64 65 66 69 |tables t|hat defi|
|000013f0| 6e 65 20 74 68 65 20 63 | 6f 6c 6f 72 73 20 69 6e |ne the c|olors in|
|00001400| 76 6f 6c 76 65 64 20 77 | 69 74 68 20 64 72 61 77 |volved w|ith draw|
|00001410| 69 6e 67 20 74 6f 20 61 | 6e 64 20 63 6f 70 79 69 |ing to a|nd copyi|
|00001420| 6e 67 20 66 72 6f 6d 20 | 74 68 65 20 6f 66 66 2d |ng from |the off-|
|00001430| 73 63 72 65 65 6e 20 69 | 6d 61 67 65 3a 20 74 68 |screen i|mage: th|
|00001440| 65 20 63 6f 6c 6f 72 20 | 74 61 62 6c 65 20 61 6e |e color |table an|
|00001450| 64 20 74 68 65 20 69 6e | 76 65 72 73 65 20 74 61 |d the in|verse ta|
|00001460| 62 6c 65 2e 20 4f 66 20 | 63 6f 75 72 73 65 2c 20 |ble. Of |course, |
|00001470| 79 6f 75 d5 6c 6c 20 6e | 65 65 64 20 74 68 65 20 |you.ll n|eed the |
|00001480| 70 69 78 65 6c 20 69 6d | 61 67 65 20 69 74 73 65 |pixel im|age itse|
|00001490| 6c 66 2c 20 77 68 69 63 | 68 20 69 73 20 6f 66 74 |lf, whic|h is oft|
|000014a0| 65 6e 20 63 61 6c 6c 65 | 64 20 74 68 65 20 d2 70 |en calle|d the .p|
|000014b0| 69 78 65 6c 20 62 75 66 | 66 65 72 d3 20 6f 72 20 |ixel buf|fer. or |
|000014c0| 74 68 65 20 d2 69 6d 61 | 67 65 20 62 75 66 66 65 |the .ima|ge buffe|
|000014d0| 72 d3 20 6f 72 20 74 68 | 65 20 d2 6f 66 66 2d 73 |r. or th|e .off-s|
|000014e0| 63 72 65 65 6e 20 62 75 | 66 66 65 72 d3 20 6f 72 |creen bu|ffer. or|
|000014f0| 20 6a 75 73 74 20 d2 74 | 68 65 20 62 75 66 66 65 | just .t|he buffe|
|00001500| 72 2e d3 20 49 74 d5 73 | 20 61 6c 77 61 79 73 20 |r.. It.s| always |
|00001510| 63 61 6c 6c 65 64 20 74 | 68 65 20 d2 70 69 78 65 |called t|he .pixe|
|00001520| 6c 20 69 6d 61 67 65 d3 | 20 69 6e 20 74 68 69 73 |l image.| in this|
|00001530| 20 4e 6f 74 65 2e 20 49 | 74 20 64 6f 65 73 6e d5 | Note. I|t doesn.|
|00001540| 74 20 6e 65 63 65 73 73 | 61 72 69 6c 79 20 62 75 |t necess|arily bu|
|00001550| 66 66 65 72 20 61 6e 79 | 74 68 69 6e 67 20 61 6e |ffer any|thing an|
|00001560| 79 77 61 79 2e 0d 54 68 | 65 20 43 47 72 61 66 50 |yway..Th|e CGrafP|
|00001570| 6f 72 74 0d 41 20 43 47 | 72 61 66 50 6f 72 74 20 |ort.A CG|rafPort |
|00001580| 64 65 73 63 72 69 62 65 | 73 20 61 20 64 72 61 77 |describe|s a draw|
|00001590| 69 6e 67 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2c |ing envi|ronment,|
|000015a0| 20 61 6e 64 20 69 74 d5 | 73 20 74 68 65 20 63 6f | and it.|s the co|
|000015b0| 6c 6f 72 20 76 65 72 73 | 69 6f 6e 20 6f 66 20 74 |lor vers|ion of t|
|000015c0| 68 65 20 47 72 61 66 50 | 6f 72 74 20 73 74 72 75 |he GrafP|ort stru|
|000015d0| 63 74 75 72 65 20 74 68 | 61 74 d5 73 20 64 65 73 |cture th|at.s des|
|000015e0| 63 72 69 62 65 64 20 6f | 6e 20 70 61 67 65 73 20 |cribed o|n pages |
|000015f0| 31 34 37 20 74 68 72 6f | 75 67 68 20 31 35 35 20 |147 thro|ugh 155 |
|00001600| 69 6e 20 74 68 65 20 51 | 75 69 63 6b 44 72 61 77 |in the Q|uickDraw|
|00001610| 20 63 68 61 70 74 65 72 | 20 6f 66 20 49 6e 73 69 | chapter| of Insi|
|00001620| 64 65 20 4d 61 63 69 6e | 74 6f 73 68 20 56 6f 6c |de Macin|tosh Vol|
|00001630| 75 6d 65 20 49 2e 20 54 | 68 65 20 64 72 61 77 69 |ume I. T|he drawi|
|00001640| 6e 67 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 63 |ng envir|onment c|
|00001650| 6f 6e 73 69 73 74 73 20 | 6f 66 2c 20 61 6d 6f 6e |onsists |of, amon|
|00001660| 67 20 6f 74 68 65 72 20 | 74 68 69 6e 67 73 2c 20 |g other |things, |
|00001670| 74 68 65 20 73 69 7a 65 | 20 61 6e 64 20 6c 6f 63 |the size| and loc|
|00001680| 61 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 67 72 61 |ation of| the gra|
|00001690| 70 68 69 63 73 20 70 65 | 6e 2c 20 74 68 65 20 66 |phics pe|n, the f|
|000016a0| 6f 72 65 67 72 6f 75 6e | 64 20 61 6e 64 20 62 61 |oregroun|d and ba|
|000016b0| 63 6b 67 72 6f 75 6e 64 | 20 63 6f 6c 6f 72 73 20 |ckground| colors |
|000016c0| 74 6f 20 75 73 65 20 77 | 68 65 6e 20 73 6f 6d 65 |to use w|hen some|
|000016d0| 74 68 69 6e 67 20 69 73 | 20 64 72 61 77 6e 2c 20 |thing is| drawn, |
|000016e0| 74 68 65 20 70 61 74 74 | 65 72 6e 20 74 6f 20 75 |the patt|ern to u|
|000016f0| 73 65 2c 20 74 68 65 20 | 72 65 67 69 6f 6e 20 74 |se, the |region t|
|00001700| 6f 20 63 6c 69 70 20 61 | 6c 6c 20 64 72 61 77 69 |o clip a|ll drawi|
|00001710| 6e 67 20 74 6f 2c 20 61 | 6e 64 20 74 68 65 20 70 |ng to, a|nd the p|
|00001720| 6f 72 74 69 6f 6e 20 6f | 66 20 61 20 70 69 78 65 |ortion o|f a pixe|
|00001730| 6c 20 69 6d 61 67 65 20 | 74 68 61 74 20 74 68 65 |l image |that the|
|00001740| 20 43 47 72 61 66 50 6f | 72 74 20 6c 6f 67 69 63 | CGrafPo|rt logic|
|00001750| 61 6c 6c 79 20 65 78 69 | 73 74 73 20 69 6e 2e 20 |ally exi|sts in. |
|00001760| 41 6e 79 20 69 6e 69 74 | 69 61 6c 69 7a 65 64 20 |Any init|ialized |
|00001770| 43 47 72 61 66 50 6f 72 | 74 20 6f 72 20 47 72 61 |CGrafPor|t or Gra|
|00001780| 66 50 6f 72 74 20 63 61 | 6e 20 62 65 20 73 65 74 |fPort ca|n be set|
|00001790| 20 61 73 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | as the |current |
|000017a0| 70 6f 72 74 20 74 68 72 | 6f 75 67 68 20 74 68 65 |port thr|ough the|
|000017b0| 20 5f 53 65 74 50 6f 72 | 74 20 72 6f 75 74 69 6e | _SetPor|t routin|
|000017c0| 65 2e 20 54 68 65 20 63 | 75 72 72 65 6e 74 20 70 |e. The c|urrent p|
|000017d0| 6f 72 74 20 69 73 20 61 | 20 73 65 74 20 6f 66 20 |ort is a| set of |
|000017e0| 70 61 72 61 6d 65 74 65 | 72 73 20 74 68 61 74 20 |paramete|rs that |
|000017f0| 61 72 65 20 69 6d 70 6c | 69 63 69 74 6c 79 20 70 |are impl|icitly p|
|00001800| 61 73 73 65 64 20 74 6f | 20 6d 6f 73 74 20 51 75 |assed to| most Qu|
|00001810| 69 63 6b 44 72 61 77 20 | 72 6f 75 74 69 6e 65 73 |ickDraw |routines|
|00001820| 2e 0d 54 68 65 20 6d 6f | 73 74 20 69 6d 70 6f 72 |..The mo|st impor|
|00001830| 74 61 6e 74 20 72 65 61 | 73 6f 6e 20 74 6f 20 62 |tant rea|son to b|
|00001840| 75 69 6c 64 20 61 20 6e | 65 77 20 43 47 72 61 66 |uild a n|ew CGraf|
|00001850| 50 6f 72 74 20 77 68 65 | 6e 20 79 6f 75 20 64 72 |Port whe|n you dr|
|00001860| 61 77 20 6f 66 66 20 73 | 63 72 65 65 6e 20 72 61 |aw off s|creen ra|
|00001870| 74 68 65 72 20 74 68 61 | 6e 20 75 73 69 6e 67 20 |ther tha|n using |
|00001880| 61 6e 20 65 78 69 73 74 | 69 6e 67 20 43 47 72 61 |an exist|ing CGra|
|00001890| 66 50 6f 72 74 20 69 73 | 20 73 6f 20 74 68 61 74 |fPort is| so that|
|000018a0| 20 73 77 69 74 63 68 69 | 6e 67 20 62 65 74 77 65 | switchi|ng betwe|
|000018b0| 65 6e 20 64 72 61 77 69 | 6e 67 20 74 6f 20 61 6e |en drawi|ng to an|
|000018c0| 20 6f 66 66 2d 73 63 72 | 65 65 6e 20 67 72 61 70 | off-scr|een grap|
|000018d0| 68 69 63 73 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |hics env|ironment|
|000018e0| 20 61 6e 64 20 64 72 61 | 77 69 6e 67 20 74 6f 20 | and dra|wing to |
|000018f0| 6f 6e 65 20 6f 72 20 6d | 6f 72 65 20 77 69 6e 64 |one or m|ore wind|
|00001900| 6f 77 73 20 28 65 61 63 | 68 20 6f 66 20 77 68 69 |ows (eac|h of whi|
|00001910| 63 68 20 69 73 20 61 6e | 20 65 78 74 65 6e 64 65 |ch is an| extende|
|00001920| 64 20 47 72 61 66 50 6f | 72 74 20 6f 72 20 43 47 |d GrafPo|rt or CG|
|00001930| 72 61 66 50 6f 72 74 20 | 73 74 72 75 63 74 75 72 |rafPort |structur|
|00001940| 65 29 20 6f 6e 20 74 68 | 65 20 73 63 72 65 65 6e |e) on th|e screen|
|00001950| 20 69 73 20 76 65 72 79 | 20 65 61 73 79 2e 20 53 | is very| easy. S|
|00001960| 6f 6d 65 20 70 65 6f 70 | 6c 65 20 75 73 65 20 6a |ome peop|le use j|
|00001970| 75 73 74 20 6f 6e 65 20 | 43 47 72 61 66 50 6f 72 |ust one |CGrafPor|
|00001980| 74 20 74 6f 20 73 68 61 | 72 65 20 62 65 74 77 65 |t to sha|re betwe|
|00001990| 65 6e 20 6f 6e 2d 73 63 | 72 65 65 6e 20 61 6e 64 |en on-sc|reen and|
|000019a0| 20 6f 66 66 2d 73 63 72 | 65 65 6e 20 67 72 61 70 | off-scr|een grap|
|000019b0| 68 69 63 73 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |hics env|ironment|
|000019c0| 73 2c 20 61 6e 64 20 73 | 77 69 74 63 68 20 74 68 |s, and s|witch th|
|000019d0| 65 69 72 20 50 69 78 4d | 61 70 20 73 74 72 75 63 |eir PixM|ap struc|
|000019e0| 74 75 72 65 73 20 74 6f | 20 73 77 69 74 63 68 20 |tures to| switch |
|000019f0| 62 65 74 77 65 65 6e 20 | 64 72 61 77 69 6e 67 20 |between |drawing |
|00001a00| 6f 6e 20 73 63 72 65 65 | 6e 20 61 6e 64 20 64 72 |on scree|n and dr|
|00001a10| 61 77 69 6e 67 20 6f 66 | 66 20 73 63 72 65 65 6e |awing of|f screen|
|00001a20| 2e 20 54 68 61 74 20 64 | 6f 65 73 20 77 6f 72 6b |. That d|oes work|
|00001a30| 2c 20 62 75 74 20 69 66 | 20 74 68 65 20 6f 66 66 |, but if| the off|
|00001a40| 2d 73 63 72 65 65 6e 20 | 61 6e 64 20 6f 6e 2d 73 |-screen |and on-s|
|00001a50| 63 72 65 65 6e 20 67 72 | 61 70 68 69 63 73 20 65 |creen gr|aphics e|
|00001a60| 6e 76 69 72 6f 6e 6d 65 | 6e 74 73 20 68 61 76 65 |nvironme|nts have|
|00001a70| 20 61 20 64 69 66 66 65 | 72 65 6e 74 20 63 6c 69 | a diffe|rent cli|
|00001a80| 70 52 67 6e 2c 20 76 69 | 73 52 67 6e 2c 20 70 65 |pRgn, vi|sRgn, pe|
|00001a90| 6e 20 63 68 61 72 61 63 | 74 65 72 69 73 74 69 63 |n charac|teristic|
|00001aa0| 2c 20 70 6f 72 74 52 65 | 63 74 2c 20 6f 72 20 61 |, portRe|ct, or a|
|00001ab0| 6e 79 20 6f 74 68 65 72 | 20 63 68 61 72 61 63 74 |ny other| charact|
|00001ac0| 65 72 69 73 74 69 63 73 | 20 74 68 61 74 20 61 72 |eristics| that ar|
|00001ad0| 65 20 64 69 66 66 65 72 | 65 6e 74 2c 20 74 68 65 |e differ|ent, the|
|00001ae0| 6e 20 74 68 6f 73 65 20 | 6d 75 73 74 20 62 65 20 |n those |must be |
|00001af0| 73 77 69 74 63 68 65 64 | 20 61 74 20 74 68 61 74 |switched| at that|
|00001b00| 20 74 69 6d 65 20 74 6f | 6f 2e 20 49 66 20 79 6f | time to|o. If yo|
|00001b10| 75 20 69 6e 73 74 65 61 | 64 20 63 72 65 61 74 65 |u instea|d create|
|00001b20| 20 61 20 43 47 72 61 66 | 50 6f 72 74 20 74 68 61 | a CGraf|Port tha|
|00001b30| 74 d5 73 20 64 65 64 69 | 63 61 74 65 64 20 74 6f |t.s dedi|cated to|
|00001b40| 20 6f 6e 65 20 67 72 61 | 70 68 69 63 73 20 65 6e | one gra|phics en|
|00001b50| 76 69 72 6f 6e 6d 65 6e | 74 2c 20 74 68 65 6e 20 |vironmen|t, then |
|00001b60| 61 20 73 69 6d 70 6c 65 | 20 63 61 6c 6c 20 74 6f |a simple| call to|
|00001b70| 20 5f 53 65 74 50 6f 72 | 74 20 65 66 66 65 63 74 | _SetPor|t effect|
|00001b80| 69 76 65 6c 79 20 73 77 | 69 74 63 68 65 73 20 61 |ively sw|itches a|
|00001b90| 6c 6c 20 74 68 65 73 65 | 20 74 68 69 6e 67 73 20 |ll these| things |
|00001ba0| 66 6f 72 20 79 6f 75 20 | 61 74 20 6f 6e 63 65 2e |for you |at once.|
|00001bb0| 20 54 68 61 74 d5 73 20 | 77 68 79 20 65 76 65 72 | That.s |why ever|
|00001bc0| 79 20 77 69 6e 64 6f 77 | 20 6f 6e 20 74 68 65 20 |y window| on the |
|00001bd0| 73 63 72 65 65 6e 20 63 | 6f 6d 65 73 20 77 69 74 |screen c|omes wit|
|00001be0| 68 20 69 74 73 20 6f 77 | 6e 20 70 6f 72 74 2e 20 |h its ow|n port. |
|00001bf0| 41 20 73 69 6d 70 6c 65 | 20 63 61 6c 6c 20 74 6f |A simple| call to|
|00001c00| 20 5f 53 65 74 50 6f 72 | 74 20 73 77 69 74 63 68 | _SetPor|t switch|
|00001c10| 65 73 20 62 65 74 77 65 | 65 6e 20 74 68 65 20 63 |es betwe|en the c|
|00001c20| 68 61 72 61 63 74 65 72 | 69 73 74 69 63 73 20 6f |haracter|istics o|
|00001c30| 66 20 65 61 63 68 20 77 | 69 6e 64 6f 77 20 65 76 |f each w|indow ev|
|00001c40| 65 6e 20 69 66 20 65 61 | 63 68 20 77 69 6e 64 6f |en if ea|ch windo|
|00001c50| 77 20 68 61 73 20 72 61 | 64 69 63 61 6c 6c 79 20 |w has ra|dically |
|00001c60| 64 69 66 66 65 72 65 6e | 74 20 64 72 61 77 69 6e |differen|t drawin|
|00001c70| 67 20 63 68 61 72 61 63 | 74 65 72 69 73 74 69 63 |g charac|teristic|
|00001c80| 73 2e 0d 54 68 65 20 43 | 47 72 61 66 50 6f 72 74 |s..The C|GrafPort|
|00001c90| 20 64 61 74 61 20 73 74 | 72 75 63 74 75 72 65 20 | data st|ructure |
|00001ca0| 69 73 20 6d 6f 72 65 20 | 63 6f 6d 70 6c 65 74 65 |is more |complete|
|00001cb0| 6c 79 20 64 65 73 63 72 | 69 62 65 64 20 69 6e 20 |ly descr|ibed in |
|00001cc0| 74 68 65 20 d2 43 6f 6c | 6f 72 20 51 75 69 63 6b |the .Col|or Quick|
|00001cd0| 44 72 61 77 d3 20 63 68 | 61 70 74 65 72 20 6f 66 |Draw. ch|apter of|
|00001ce0| 20 49 6e 73 69 64 65 20 | 4d 61 63 69 6e 74 6f 73 | Inside |Macintos|
|00001cf0| 68 20 56 6f 6c 75 6d 65 | 20 56 2c 20 70 61 67 65 |h Volume| V, page|
|00001d00| 73 20 34 39 20 74 68 72 | 6f 75 67 68 20 35 32 2c |s 49 thr|ough 52,|
|00001d10| 20 61 6e 64 20 69 6e 20 | 74 68 65 20 d2 47 72 61 | and in |the .Gra|
|00001d20| 70 68 69 63 73 20 4f 76 | 65 72 76 69 65 77 d3 20 |phics Ov|erview. |
|00001d30| 63 68 61 70 74 65 72 20 | 6f 66 20 49 6e 73 69 64 |chapter |of Insid|
|00001d40| 65 20 4d 61 63 69 6e 74 | 6f 73 68 20 56 6f 6c 75 |e Macint|osh Volu|
|00001d50| 6d 65 20 56 49 2c 20 70 | 61 67 65 73 20 31 36 2d |me VI, p|ages 16-|
|00001d60| 31 32 20 74 68 72 6f 75 | 67 68 20 31 36 2d 31 33 |12 throu|gh 16-13|
|00001d70| 2e 0d 54 68 65 20 50 69 | 78 4d 61 70 0d 41 20 70 |..The Pi|xMap.A p|
|00001d80| 69 78 65 6c 20 69 6d 61 | 67 65 20 61 6c 6f 6e 65 |ixel ima|ge alone|
|00001d90| 20 69 73 20 6a 75 73 74 | 20 61 20 66 6f 72 6d 6c | is just| a forml|
|00001da0| 65 73 73 20 62 6c 6f 62 | 20 6f 66 20 6d 65 6d 6f |ess blob| of memo|
|00001db0| 72 79 2e 20 50 69 78 65 | 6c 20 6d 61 70 73 2c 20 |ry. Pixe|l maps, |
|00001dc0| 64 65 66 69 6e 65 64 20 | 62 79 20 74 68 65 20 50 |defined |by the P|
|00001dd0| 69 78 4d 61 70 20 73 74 | 72 75 63 74 75 72 65 2c |ixMap st|ructure,|
|00001de0| 20 64 65 73 63 72 69 62 | 65 20 70 69 78 65 6c 20 | describ|e pixel |
|00001df0| 69 6d 61 67 65 73 2c 20 | 67 69 76 69 6e 67 20 74 |images, |giving t|
|00001e00| 68 65 6d 20 61 20 66 6f | 72 6d 20 61 6e 64 20 73 |hem a fo|rm and s|
|00001e10| 74 72 75 63 74 75 72 65 | 20 74 68 61 74 d5 73 20 |tructure| that.s |
|00001e20| 73 75 69 74 61 62 6c 65 | 20 66 6f 72 20 43 6f 6c |suitable| for Col|
|00001e30| 6f 72 20 51 75 69 63 6b | 44 72 61 77 20 74 6f 20 |or Quick|Draw to |
|00001e40| 64 72 61 77 20 69 6e 74 | 6f 20 74 68 65 6d 20 61 |draw int|o them a|
|00001e50| 6e 64 20 63 6f 70 79 20 | 66 72 6f 6d 20 74 68 65 |nd copy |from the|
|00001e60| 6d 2e 20 54 68 65 20 50 | 69 78 4d 61 70 20 73 74 |m. The P|ixMap st|
|00001e70| 72 75 63 74 75 72 65 20 | 74 65 6c 6c 73 20 79 6f |ructure |tells yo|
|00001e80| 75 20 74 68 65 20 64 69 | 6d 65 6e 73 69 6f 6e 73 |u the di|mensions|
|00001e90| 20 61 6e 64 20 6c 6f 63 | 61 74 69 6f 6e 20 69 6e | and loc|ation in|
|00001ea0| 20 6d 65 6d 6f 72 79 20 | 6f 66 20 74 68 65 20 70 | memory |of the p|
|00001eb0| 69 78 65 6c 20 69 6d 61 | 67 65 2c 20 69 74 73 20 |ixel ima|ge, its |
|00001ec0| 63 6f 6f 72 64 69 6e 61 | 74 65 20 73 79 73 74 65 |coordina|te syste|
|00001ed0| 6d 2c 20 61 6e 64 20 74 | 68 65 20 64 65 70 74 68 |m, and t|he depth|
|00001ee0| 20 61 6e 64 20 66 6f 72 | 6d 61 74 20 6f 66 20 74 | and for|mat of t|
|00001ef0| 68 65 20 70 69 78 65 6c | 73 2e 20 50 69 78 65 6c |he pixel|s. Pixel|
|00001f00| 20 6d 61 70 73 20 74 68 | 61 74 20 64 65 73 63 72 | maps th|at descr|
|00001f10| 69 62 65 20 69 6e 64 65 | 78 65 64 2d 63 6f 6c 6f |ibe inde|xed-colo|
|00001f20| 72 20 70 69 78 65 6c 20 | 69 6d 61 67 65 73 20 61 |r pixel |images a|
|00001f30| 64 64 69 74 69 6f 6e 61 | 6c 6c 79 20 64 65 73 63 |dditiona|lly desc|
|00001f40| 72 69 62 65 20 74 68 65 | 20 63 6f 6c 6f 72 73 20 |ribe the| colors |
|00001f50| 74 68 61 74 20 61 72 65 | 20 72 65 70 72 65 73 65 |that are| represe|
|00001f60| 6e 74 65 64 20 62 79 20 | 74 68 65 20 76 61 6c 75 |nted by |the valu|
|00001f70| 65 73 20 6f 66 20 74 68 | 65 20 70 69 78 65 6c 73 |es of th|e pixels|
|00001f80| 20 69 6e 20 74 68 65 20 | 70 69 78 65 6c 20 69 6d | in the |pixel im|
|00001f90| 61 67 65 2e 20 54 68 69 | 73 20 69 73 20 64 6f 6e |age. Thi|s is don|
|00001fa0| 65 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 63 6f |e throug|h the co|
|00001fb0| 6c 6f 72 20 74 61 62 6c | 65 2c 20 61 6c 73 6f 20 |lor tabl|e, also |
|00001fc0| 6b 6e 6f 77 6e 20 61 73 | 20 74 68 65 20 63 6f 6c |known as| the col|
|00001fd0| 6f 72 20 6c 6f 6f 6b 2d | 75 70 20 74 61 62 6c 65 |or look-|up table|
|00001fe0| 20 6f 72 20 43 4c 55 54 | 2e 20 43 6f 6c 6f 72 20 | or CLUT|. Color |
|00001ff0| 74 61 62 6c 65 73 20 61 | 72 65 20 61 74 74 61 63 |tables a|re attac|
|00002000| 68 65 64 20 74 6f 20 70 | 69 78 65 6c 20 6d 61 70 |hed to p|ixel map|
|00002010| 73 20 74 68 72 6f 75 67 | 68 20 74 68 65 69 72 20 |s throug|h their |
|00002020| 70 6d 54 61 62 6c 65 20 | 66 69 65 6c 64 2e 20 44 |pmTable |field. D|
|00002030| 69 72 65 63 74 2d 63 6f | 6c 6f 72 20 70 69 78 65 |irect-co|lor pixe|
|00002040| 6c 20 69 6d 61 67 65 73 | 20 68 61 76 65 20 70 69 |l images| have pi|
|00002050| 78 65 6c 20 76 61 6c 75 | 65 73 20 74 68 61 74 20 |xel valu|es that |
|00002060| 64 65 73 63 72 69 62 65 | 20 74 68 65 69 72 20 6f |describe| their o|
|00002070| 77 6e 20 63 6f 6c 6f 72 | 73 2c 20 61 6e 64 20 73 |wn color|s, and s|
|00002080| 6f 20 63 6f 6c 6f 72 20 | 74 61 62 6c 65 73 20 61 |o color |tables a|
|00002090| 72 65 6e d5 74 20 6e 65 | 65 64 65 64 20 66 6f 72 |ren.t ne|eded for|
|000020a0| 20 74 68 6f 73 65 2e 0d | 54 68 65 20 50 69 78 4d | those..|The PixM|
|000020b0| 61 70 20 73 74 72 75 63 | 74 75 72 65 20 69 73 20 |ap struc|ture is |
|000020c0| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 74 68 65 |describe|d in the|
|000020d0| 20 d2 43 6f 6c 6f 72 20 | 51 75 69 63 6b 44 72 61 | .Color |QuickDra|
|000020e0| 77 d3 20 63 68 61 70 74 | 65 72 20 6f 66 20 49 6e |w. chapt|er of In|
|000020f0| 73 69 64 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 56 |side Mac|intosh V|
|00002100| 6f 6c 75 6d 65 20 56 2c | 20 70 61 67 65 73 20 35 |olume V,| pages 5|
|00002110| 32 20 74 68 72 6f 75 67 | 68 20 35 35 2c 20 61 6e |2 throug|h 55, an|
|00002120| 64 20 69 6e 20 74 68 65 | 20 d2 47 72 61 70 68 69 |d in the| .Graphi|
|00002130| 63 73 20 4f 76 65 72 76 | 69 65 77 d3 20 63 68 61 |cs Overv|iew. cha|
|00002140| 70 74 65 72 20 6f 66 20 | 49 6e 73 69 64 65 20 4d |pter of |Inside M|
|00002150| 61 63 69 6e 74 6f 73 68 | 20 56 6f 6c 75 6d 65 20 |acintosh| Volume |
|00002160| 56 49 2c 20 70 61 67 65 | 73 20 31 36 2d 31 31 20 |VI, page|s 16-11 |
|00002170| 74 68 72 6f 75 67 68 20 | 31 36 2d 31 32 2e 20 54 |through |16-12. T|
|00002180| 68 65 20 63 6f 6e 63 65 | 70 74 20 6f 66 20 64 69 |he conce|pt of di|
|00002190| 72 65 63 74 2d 63 6f 6c | 6f 72 20 61 6e 64 20 69 |rect-col|or and i|
|000021a0| 6e 64 65 78 65 64 2d 63 | 6f 6c 6f 72 20 70 69 78 |ndexed-c|olor pix|
|000021b0| 65 6c 73 20 69 73 20 64 | 65 73 63 72 69 62 65 64 |els is d|escribed|
|000021c0| 20 69 6e 20 74 68 69 73 | 20 73 61 6d 65 20 63 68 | in this| same ch|
|000021d0| 61 70 74 65 72 20 6f 6e | 20 70 61 67 65 73 20 31 |apter on| pages 1|
|000021e0| 36 2d 31 36 20 74 68 72 | 6f 75 67 68 20 31 36 2d |6-16 thr|ough 16-|
|000021f0| 31 38 2c 20 61 6e 64 20 | 61 6c 73 6f 20 69 6e 20 |18, and |also in |
|00002200| 74 68 65 20 d2 43 6f 6c | 6f 72 20 51 75 69 63 6b |the .Col|or Quick|
|00002210| 44 72 61 77 d3 20 63 68 | 61 70 74 65 72 20 6f 66 |Draw. ch|apter of|
|00002220| 20 74 68 65 20 73 61 6d | 65 20 76 6f 6c 75 6d 65 | the sam|e volume|
|00002230| 20 6f 6e 20 70 61 67 65 | 73 20 31 37 2d 34 20 74 | on page|s 17-4 t|
|00002240| 68 72 6f 75 67 68 20 31 | 37 2d 31 30 2e 0d 54 68 |hrough 1|7-10..Th|
|00002250| 65 20 47 44 65 76 69 63 | 65 0d 47 72 61 70 68 69 |e GDevic|e.Graphi|
|00002260| 63 73 20 64 65 76 69 63 | 65 73 2c 20 64 65 66 69 |cs devic|es, defi|
|00002270| 6e 65 64 20 62 79 20 74 | 68 65 20 47 44 65 76 69 |ned by t|he GDevi|
|00002280| 63 65 20 73 74 72 75 63 | 74 75 72 65 2c 20 64 65 |ce struc|ture, de|
|00002290| 73 63 72 69 62 65 20 63 | 6f 6c 6f 72 20 65 6e 76 |scribe c|olor env|
|000022a0| 69 72 6f 6e 6d 65 6e 74 | 73 2e 20 54 68 65 79 d5 |ironment|s. They.|
|000022b0| 72 65 20 74 68 65 20 6d | 6f 73 74 20 6d 69 73 75 |re the m|ost misu|
|000022c0| 6e 64 65 72 73 74 6f 6f | 64 20 64 61 74 61 20 73 |nderstoo|d data s|
|000022d0| 74 72 75 63 74 75 72 65 | 20 77 68 65 6e 20 69 74 |tructure| when it|
|000022e0| 20 63 6f 6d 65 73 20 74 | 6f 20 6f 66 66 2d 73 63 | comes t|o off-sc|
|000022f0| 72 65 65 6e 20 67 72 61 | 70 68 69 63 73 20 65 6e |reen gra|phics en|
|00002300| 76 69 72 6f 6e 6d 65 6e | 74 73 20 66 6f 72 20 74 |vironmen|ts for t|
|00002310| 68 72 65 65 20 6d 61 6a | 6f 72 20 72 65 61 73 6f |hree maj|or reaso|
|00002320| 6e 73 3a 20 66 69 72 73 | 74 2c 20 74 68 65 79 d5 |ns: firs|t, they.|
|00002330| 72 65 20 6e 6f 74 20 6f | 72 69 67 69 6e 61 6c 6c |re not o|riginall|
|00002340| 79 20 64 6f 63 75 6d 65 | 6e 74 65 64 20 61 73 20 |y docume|nted as |
|00002350| 62 65 69 6e 67 20 72 65 | 6c 65 76 61 6e 74 20 74 |being re|levant t|
|00002360| 6f 20 68 75 6d 61 6e 73 | 3b 20 73 65 63 6f 6e 64 |o humans|; second|
|00002370| 2c 20 74 68 65 79 20 6c | 6f 6f 6b 20 61 73 20 74 |, they l|ook as t|
|00002380| 68 6f 75 67 68 20 74 68 | 65 79 d5 72 65 20 6f 6e |hough th|ey.re on|
|00002390| 6c 79 20 66 6f 72 20 73 | 63 72 65 65 6e 73 3b 20 |ly for s|creens; |
|000023a0| 61 6e 64 20 74 68 69 72 | 64 2c 20 69 74 20 6c 6f |and thir|d, it lo|
|000023b0| 6f 6b 73 20 61 73 20 74 | 68 6f 75 67 68 20 63 6f |oks as t|hough co|
|000023c0| 6c 6f 72 20 74 61 62 6c | 65 73 20 64 65 73 63 72 |lor tabl|es descr|
|000023d0| 69 62 65 20 63 6f 6c 6f | 72 20 65 6e 76 69 72 6f |ibe colo|r enviro|
|000023e0| 6e 6d 65 6e 74 73 2e 20 | 57 65 20 63 61 6e 20 64 |nments. |We can d|
|000023f0| 69 73 70 6f 73 65 20 6f | 66 20 74 68 65 73 65 20 |ispose o|f these |
|00002400| 6d 79 74 68 73 20 68 65 | 72 65 3a 20 67 72 61 70 |myths he|re: grap|
|00002410| 68 69 63 73 20 64 65 76 | 69 63 65 73 20 61 72 65 |hics dev|ices are|
|00002420| 20 64 6f 63 75 6d 65 6e | 74 65 64 20 61 73 20 62 | documen|ted as b|
|00002430| 65 69 6e 67 20 75 73 65 | 66 75 6c 20 74 6f 20 68 |eing use|ful to h|
|00002440| 75 6d 61 6e 69 74 79 20 | 69 6e 20 74 68 69 73 20 |umanity |in this |
|00002450| 4e 6f 74 65 20 61 74 20 | 6c 65 61 73 74 3b 20 74 |Note at |least; t|
|00002460| 68 65 79 d5 72 65 20 63 | 72 69 74 69 63 61 6c 6c |hey.re c|riticall|
|00002470| 79 20 69 6d 70 6f 72 74 | 61 6e 74 20 66 6f 72 20 |y import|ant for |
|00002480| 62 6f 74 68 20 6f 6e 2d | 73 63 72 65 65 6e 20 61 |both on-|screen a|
|00002490| 6e 64 20 6f 66 66 2d 73 | 63 72 65 65 6e 20 64 72 |nd off-s|creen dr|
|000024a0| 61 77 69 6e 67 3b 20 61 | 6e 64 20 63 6f 6c 6f 72 |awing; a|nd color|
|000024b0| 20 74 61 62 6c 65 73 20 | 64 65 73 63 72 69 62 65 | tables |describe|
|000024c0| 20 74 68 65 20 63 6f 6c | 6f 72 73 20 69 6e 20 70 | the col|ors in p|
|000024d0| 69 78 65 6c 20 69 6d 61 | 67 65 73 2c 20 6e 6f 74 |ixel ima|ges, not|
|000024e0| 20 63 6f 6c 6f 72 20 65 | 6e 76 69 72 6f 6e 6d 65 | color e|nvironme|
|000024f0| 6e 74 73 2e 0d 57 68 61 | 74 d5 73 20 61 6c 6c 20 |nts..Wha|t.s all |
|00002500| 74 68 69 73 20 61 62 6f | 75 74 20 63 6f 6c 6f 72 |this abo|ut color|
|00002510| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 73 3f 20 49 | environ|ments? I|
|00002520| 6e 20 74 68 65 6f 72 79 | 2c 20 74 68 65 72 65 20 |n theory|, there |
|00002530| 61 72 65 20 76 69 72 74 | 75 61 6c 6c 79 20 74 68 |are virt|ually th|
|00002540| 72 65 65 20 68 75 6e 64 | 72 65 64 20 74 72 69 6c |ree hund|red tril|
|00002550| 6c 69 6f 6e 20 63 6f 6c | 6f 72 73 20 61 76 61 69 |lion col|ors avai|
|00002560| 6c 61 62 6c 65 20 77 69 | 74 68 20 43 6f 6c 6f 72 |lable wi|th Color|
|00002570| 20 51 75 69 63 6b 44 72 | 61 77 20 74 68 72 6f 75 | QuickDr|aw throu|
|00002580| 67 68 20 74 68 65 20 34 | 38 2d 62 69 74 20 52 47 |gh the 4|8-bit RG|
|00002590| 42 43 6f 6c 6f 72 20 72 | 65 63 6f 72 64 2e 20 49 |BColor r|ecord. I|
|000025a0| 6e 20 72 65 61 6c 69 74 | 79 2c 20 74 68 65 72 65 |n realit|y, there|
|000025b0| 20 61 72 65 20 6e 65 76 | 65 72 20 74 68 69 73 20 | are nev|er this |
|000025c0| 6d 61 6e 79 20 63 6f 6c | 6f 72 73 20 61 76 61 69 |many col|ors avai|
|000025d0| 6c 61 62 6c 65 2c 20 61 | 6e 64 20 69 6e 20 66 61 |lable, a|nd in fa|
|000025e0| 63 74 20 74 68 65 72 65 | 20 6d 69 67 68 74 20 62 |ct there| might b|
|000025f0| 65 20 6f 6e 6c 79 20 74 | 77 6f 2e 20 43 6f 6c 6f |e only t|wo. Colo|
|00002600| 72 20 51 75 69 63 6b 44 | 72 61 77 20 6d 61 70 73 |r QuickD|raw maps|
|00002610| 20 74 68 65 20 74 68 65 | 6f 72 65 74 69 63 61 6c | the the|oretical|
|00002620| 20 63 6f 6c 6f 72 20 74 | 68 61 74 20 79 6f 75 20 | color t|hat you |
|00002630| 73 70 65 63 69 66 79 20 | 74 6f 20 74 68 65 20 70 |specify |to the p|
|00002640| 69 78 65 6c 20 76 61 6c | 75 65 20 6f 66 20 74 68 |ixel val|ue of th|
|00002650| 65 20 63 6c 6f 73 65 73 | 74 20 61 76 61 69 6c 61 |e closes|t availa|
|00002660| 62 6c 65 20 63 6f 6c 6f | 72 20 69 6e 20 74 68 65 |ble colo|r in the|
|00002670| 20 63 75 72 72 65 6e 74 | 20 63 6f 6c 6f 72 20 65 | current| color e|
|00002680| 6e 76 69 72 6f 6e 6d 65 | 6e 74 2e 20 54 68 69 73 |nvironme|nt. This|
|00002690| 20 63 61 6e 20 62 65 20 | 64 6f 6e 65 20 77 69 74 | can be |done wit|
|000026a0| 68 20 61 20 63 6f 6c 6f | 72 20 74 61 62 6c 65 2c |h a colo|r table,|
|000026b0| 20 62 75 74 20 74 68 61 | 74 d5 73 20 6e 6f 74 20 | but tha|t.s not |
|000026c0| 76 65 72 79 20 65 66 66 | 69 63 69 65 6e 74 2e 20 |very eff|icient. |
|000026d0| 46 69 6e 64 69 6e 67 20 | 74 68 65 20 63 6c 6f 73 |Finding |the clos|
|000026e0| 65 73 74 20 61 76 61 69 | 6c 61 62 6c 65 20 63 6f |est avai|lable co|
|000026f0| 6c 6f 72 20 74 6f 20 61 | 6e 20 52 47 42 43 6f 6c |lor to a|n RGBCol|
|00002700| 6f 72 20 69 6e 20 61 20 | 63 6f 6c 6f 72 20 74 61 |or in a |color ta|
|00002710| 62 6c 65 20 6d 65 61 6e | 73 20 73 65 61 72 63 68 |ble mean|s search|
|00002720| 69 6e 67 20 74 68 65 20 | 65 6e 74 69 72 65 20 63 |ing the |entire c|
|00002730| 6f 6c 6f 72 20 74 61 62 | 6c 65 20 66 6f 72 20 74 |olor tab|le for t|
|00002740| 68 61 74 20 6f 6e 65 20 | 63 6c 6f 73 65 73 74 20 |hat one |closest |
|00002750| 63 6f 6c 6f 72 2e 20 49 | 66 20 74 68 61 74 d5 73 |color. I|f that.s|
|00002760| 20 64 6f 6e 65 20 6a 75 | 73 74 20 6f 6e 63 65 2c | done ju|st once,|
|00002770| 20 74 68 65 6e 20 70 65 | 72 66 6f 72 6d 61 6e 63 | then pe|rformanc|
|00002780| 65 20 69 73 6e d5 74 20 | 6d 75 63 68 20 6f 66 20 |e isn.t |much of |
|00002790| 61 6e 20 69 73 73 75 65 | 2c 20 62 75 74 20 69 66 |an issue|, but if|
|000027a0| 20 69 74 d5 73 20 64 6f | 6e 65 20 6d 61 6e 79 20 | it.s do|ne many |
|000027b0| 74 69 6d 65 73 2c 20 74 | 68 65 20 70 65 72 66 6f |times, t|he perfo|
|000027c0| 72 6d 61 6e 63 65 20 68 | 69 74 20 63 6f 75 6c 64 |rmance h|it could|
|000027d0| 20 62 65 20 73 69 67 6e | 69 66 69 63 61 6e 74 2e | be sign|ificant.|
|000027e0| 20 41 20 76 65 72 79 20 | 62 61 64 20 63 61 73 65 | A very |bad case|
|000027f0| 20 6f 66 20 74 68 69 73 | 20 69 73 20 5f 43 6f 70 | of this| is _Cop|
|00002800| 79 42 69 74 73 2c 20 77 | 68 65 72 65 20 65 76 65 |yBits, w|here eve|
|00002810| 72 79 20 70 69 78 65 6c | 20 76 61 6c 75 65 20 69 |ry pixel| value i|
|00002820| 6e 20 74 68 65 20 73 6f | 75 72 63 65 20 69 6d 61 |n the so|urce ima|
|00002830| 67 65 20 69 73 20 63 6f | 6e 76 65 72 74 65 64 20 |ge is co|nverted |
|00002840| 74 6f 20 61 6e 20 52 47 | 42 43 6f 6c 6f 72 20 62 |to an RG|BColor b|
|00002850| 79 20 6c 6f 6f 6b 69 6e | 67 20 69 74 20 75 70 20 |y lookin|g it up |
|00002860| 69 6e 20 74 68 65 20 63 | 6f 6c 6f 72 20 74 61 62 |in the c|olor tab|
|00002870| 6c 65 20 6f 66 20 74 68 | 65 20 73 6f 75 72 63 65 |le of th|e source|
|00002880| 20 50 69 78 4d 61 70 2e | 20 49 66 20 74 68 65 20 | PixMap.| If the |
|00002890| 63 6f 6c 6f 72 20 74 61 | 62 6c 65 20 6f 66 20 74 |color ta|ble of t|
|000028a0| 68 65 20 64 65 73 74 69 | 6e 61 74 69 6f 6e 20 50 |he desti|nation P|
|000028b0| 69 78 4d 61 70 20 68 61 | 64 20 74 6f 20 62 65 20 |ixMap ha|d to be |
|000028c0| 73 65 61 72 63 68 65 64 | 20 74 6f 20 66 69 6e 64 |searched| to find|
|000028d0| 20 74 68 65 20 63 6c 6f | 73 65 73 74 20 61 76 61 | the clo|sest ava|
|000028e0| 69 6c 61 62 6c 65 20 63 | 6f 6c 6f 72 20 66 6f 72 |ilable c|olor for|
|000028f0| 20 65 76 65 72 79 20 70 | 69 78 65 6c 20 69 6e 20 | every p|ixel in |
|00002900| 74 68 65 20 73 6f 75 72 | 63 65 20 50 69 78 4d 61 |the sour|ce PixMa|
|00002910| 70 2c 20 74 68 65 6e 20 | 74 68 65 20 70 65 72 66 |p, then |the perf|
|00002920| 6f 72 6d 61 6e 63 65 20 | 6f 66 20 65 76 65 6e 20 |ormance |of even |
|00002930| 74 68 65 20 6d 6f 73 74 | 20 73 74 72 61 69 67 68 |the most| straigh|
|00002940| 74 66 6f 72 77 61 72 64 | 20 5f 43 6f 70 79 42 69 |tforward| _CopyBi|
|00002950| 74 73 20 63 61 6c 6c 20 | 63 6f 75 6c 64 20 62 65 |ts call |could be|
|00002960| 20 61 20 6c 6f 74 20 73 | 6c 6f 77 65 72 20 74 68 | a lot s|lower th|
|00002970| 61 6e 20 69 74 20 68 61 | 73 20 74 6f 20 62 65 2e |an it ha|s to be.|
|00002980| 0d 54 6f 20 61 76 6f 69 | 64 20 74 68 69 73 20 70 |.To avoi|d this p|
|00002990| 65 72 66 6f 72 6d 61 6e | 63 65 20 68 69 74 2c 20 |erforman|ce hit, |
|000029a0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 47 44 65 76 |the curr|ent GDev|
|000029b0| 69 63 65 20 70 72 6f 76 | 69 64 65 73 20 61 6e 20 |ice prov|ides an |
|000029c0| 69 6e 76 65 72 73 65 20 | 74 61 62 6c 65 20 61 6e |inverse |table an|
|000029d0| 64 20 61 20 64 65 76 69 | 63 65 20 74 79 70 65 20 |d a devi|ce type |
|000029e0| 77 68 69 63 68 20 61 72 | 65 20 75 73 65 64 20 74 |which ar|e used t|
|000029f0| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 74 68 65 20 |o determ|ine the |
|00002a00| 61 76 61 69 6c 61 62 6c | 65 20 73 65 74 20 6f 66 |availabl|e set of|
|00002a10| 20 63 6f 6c 6f 72 73 2e | 20 49 6e 76 65 72 73 65 | colors.| Inverse|
|00002a20| 20 74 61 62 6c 65 73 20 | 61 72 65 20 61 6e 74 69 | tables |are anti|
|00002a30| 63 6f 6c 6f 72 20 74 61 | 62 6c 65 73 2e 20 57 68 |color ta|bles. Wh|
|00002a40| 65 72 65 20 63 6f 6c 6f | 72 20 74 61 62 6c 65 73 |ere colo|r tables|
|00002a50| 20 67 69 76 65 20 79 6f | 75 20 61 20 63 6f 6c 6f | give yo|u a colo|
|00002a60| 72 20 66 6f 72 20 61 20 | 67 69 76 65 6e 20 70 69 |r for a |given pi|
|00002a70| 78 65 6c 20 76 61 6c 75 | 65 2c 20 69 6e 76 65 72 |xel valu|e, inver|
|00002a80| 73 65 20 74 61 62 6c 65 | 73 20 67 69 76 65 20 79 |se table|s give y|
|00002a90| 6f 75 20 61 20 70 69 78 | 65 6c 20 76 61 6c 75 65 |ou a pix|el value|
|00002aa0| 20 66 6f 72 20 61 20 67 | 69 76 65 6e 20 63 6f 6c | for a g|iven col|
|00002ab0| 6f 72 2e 20 45 76 65 72 | 79 20 63 6f 6e 63 65 69 |or. Ever|y concei|
|00002ac0| 76 61 62 6c 65 20 63 6f | 6c 6f 72 20 74 61 62 6c |vable co|lor tabl|
|00002ad0| 65 20 68 61 73 20 61 20 | 63 6f 72 72 65 73 70 6f |e has a |correspo|
|00002ae0| 6e 64 69 6e 67 20 63 6f | 6e 63 65 69 76 61 62 6c |nding co|nceivabl|
|00002af0| 65 20 69 6e 76 65 72 73 | 65 20 74 61 62 6c 65 2c |e invers|e table,|
|00002b00| 20 6a 75 73 74 20 61 73 | 20 65 76 65 72 79 20 70 | just as| every p|
|00002b10| 6f 73 69 74 69 76 65 20 | 72 65 61 6c 20 6e 75 6d |ositive |real num|
|00002b20| 62 65 72 20 68 61 73 20 | 61 20 63 6f 72 72 65 73 |ber has |a corres|
|00002b30| 70 6f 6e 64 69 6e 67 20 | 6e 65 67 61 74 69 76 65 |ponding |negative|
|00002b40| 20 72 65 61 6c 20 6e 75 | 6d 62 65 72 2c 20 6f 72 | real nu|mber, or|
|00002b50| 20 65 76 65 72 79 20 4d | 72 2e 20 53 70 6f 63 6b | every M|r. Spock|
|00002b60| 20 68 61 73 20 61 20 63 | 6f 72 72 65 73 70 6f 6e | has a c|orrespon|
|00002b70| 64 69 6e 67 20 4d 72 2e | 20 53 70 6f 63 6b 20 77 |ding Mr.| Spock w|
|00002b80| 69 74 68 20 61 20 67 6f | 61 74 65 65 2e 20 54 68 |ith a go|atee. Th|
|00002b90| 65 20 64 65 76 69 63 65 | 20 74 79 70 65 20 73 70 |e device| type sp|
|00002ba0| 65 63 69 66 69 65 73 20 | 77 68 65 74 68 65 72 20 |ecifies |whether |
|00002bb0| 74 68 65 20 63 6f 6c 6f | 72 20 65 6e 76 69 72 6f |the colo|r enviro|
|00002bc0| 6e 6d 65 6e 74 20 75 73 | 65 73 20 74 68 65 20 69 |nment us|es the i|
|00002bd0| 6e 64 65 78 65 64 2d 63 | 6f 6c 6f 72 2c 20 66 69 |ndexed-c|olor, fi|
|00002be0| 78 65 64 2d 63 6f 6c 6f | 72 2c 20 6f 72 20 64 69 |xed-colo|r, or di|
|00002bf0| 72 65 63 74 2d 63 6f 6c | 6f 72 20 6d 6f 64 65 6c |rect-col|or model|
|00002c00| 2e 20 49 6e 20 74 68 65 | 20 64 69 72 65 63 74 2d |. In the| direct-|
|00002c10| 63 6f 6c 6f 72 20 6d 6f | 64 65 6c 2c 20 74 68 65 |color mo|del, the|
|00002c20| 20 69 6e 76 65 72 73 65 | 20 74 61 62 6c 65 20 69 | inverse| table i|
|00002c30| 73 20 65 6d 70 74 79 2e | 20 4f 6e 6c 79 20 74 68 |s empty.| Only th|
|00002c40| 65 20 69 6e 64 65 78 65 | 64 2d 63 6f 6c 6f 72 20 |e indexe|d-color |
|00002c50| 61 6e 64 20 64 69 72 65 | 63 74 2d 63 6f 6c 6f 72 |and dire|ct-color|
|00002c60| 20 6d 6f 64 65 6c 73 20 | 61 72 65 20 64 65 73 63 | models |are desc|
|00002c70| 72 69 62 65 64 20 69 6e | 20 74 68 69 73 20 4e 6f |ribed in| this No|
|00002c80| 74 65 2e 0d 57 68 65 6e | 20 79 6f 75 20 73 70 65 |te..When| you spe|
|00002c90| 63 69 66 79 20 61 20 63 | 6f 6c 6f 72 20 69 6e 20 |cify a c|olor in |
|00002ca0| 61 6e 20 69 6e 64 65 78 | 65 64 2d 63 6f 6c 6f 72 |an index|ed-color|
|00002cb0| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2c 20 43 6f | environ|ment, Co|
|00002cc0| 6c 6f 72 20 51 75 69 63 | 6b 44 72 61 77 20 74 61 |lor Quic|kDraw ta|
|00002cd0| 6b 65 73 20 74 68 65 20 | 52 47 42 43 6f 6c 6f 72 |kes the |RGBColor|
|00002ce0| 20 73 70 65 63 69 66 69 | 63 61 74 69 6f 6e 20 61 | specifi|cation a|
|00002cf0| 6e 64 20 63 6f 6e 76 65 | 72 74 73 20 69 74 20 69 |nd conve|rts it i|
|00002d00| 6e 74 6f 20 61 20 76 61 | 6c 75 65 20 74 68 61 74 |nto a va|lue that|
|00002d10| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 61 73 20 | can be |used as |
|00002d20| 61 6e 20 69 6e 64 65 78 | 20 69 6e 74 6f 20 74 68 |an index| into th|
|00002d30| 65 20 69 6e 76 65 72 73 | 65 20 74 61 62 6c 65 20 |e invers|e table |
|00002d40| 6f 66 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 47 |of the c|urrent G|
|00002d50| 44 65 76 69 63 65 2e 20 | 54 6f 20 64 6f 20 74 68 |Device. |To do th|
|00002d60| 69 73 20 63 6f 6e 76 65 | 72 73 69 6f 6e 2c 20 43 |is conve|rsion, C|
|00002d70| 6f 6c 6f 72 20 51 75 69 | 63 6b 44 72 61 77 20 74 |olor Qui|ckDraw t|
|00002d80| 61 6b 65 73 20 74 68 65 | 20 74 6f 70 20 66 65 77 |akes the| top few|
|00002d90| 20 73 69 67 6e 69 66 69 | 63 61 6e 74 20 62 69 74 | signifi|cant bit|
|00002da0| 73 20 6f 66 20 65 61 63 | 68 20 63 6f 6c 6f 72 20 |s of eac|h color |
|00002db0| 63 6f 6d 70 6f 6e 65 6e | 74 20 61 6e 64 20 63 6f |componen|t and co|
|00002dc0| 6d 62 69 6e 65 73 20 74 | 68 65 6d 20 69 6e 74 6f |mbines t|hem into|
|00002dd0| 20 70 61 72 74 20 6f 66 | 20 61 20 31 36 2d 62 69 | part of| a 16-bi|
|00002de0| 74 20 77 6f 72 64 2c 20 | 62 6c 75 65 20 62 69 74 |t word, |blue bit|
|00002df0| 73 20 69 6e 20 74 68 65 | 20 6c 65 61 73 74 20 73 |s in the| least s|
|00002e00| 69 67 6e 69 66 69 63 61 | 6e 74 20 62 69 74 73 2c |ignifica|nt bits,|
|00002e10| 20 67 72 65 65 6e 20 62 | 69 74 73 20 72 69 67 68 | green b|its righ|
|00002e20| 74 20 61 62 6f 76 65 20 | 69 74 2c 20 61 6e 64 20 |t above |it, and |
|00002e30| 74 68 65 20 72 65 64 20 | 62 69 74 73 20 72 69 67 |the red |bits rig|
|00002e40| 68 74 20 61 62 6f 76 65 | 20 67 72 65 65 6e 20 62 |ht above| green b|
|00002e50| 69 74 73 2e 20 41 6e 79 | 20 75 6e 75 73 65 64 20 |its. Any| unused |
|00002e60| 62 69 74 73 20 61 72 65 | 20 69 6e 20 74 68 65 20 |bits are| in the |
|00002e70| 6d 6f 73 74 20 73 69 67 | 6e 69 66 69 63 61 6e 74 |most sig|nificant|
|00002e80| 20 62 69 74 73 20 6f 66 | 20 74 68 65 20 31 36 2d | bits of| the 16-|
|00002e90| 62 69 74 20 77 6f 72 64 | 2e 20 54 68 65 20 72 65 |bit word|. The re|
|00002ea0| 73 75 6c 74 69 6e 67 20 | 31 36 2d 62 69 74 20 77 |sulting |16-bit w|
|00002eb0| 6f 72 64 20 69 73 20 75 | 73 65 64 20 61 73 20 61 |ord is u|sed as a|
|00002ec0| 6e 20 69 6e 64 65 78 20 | 69 6e 74 6f 20 74 68 65 |n index |into the|
|00002ed0| 20 69 6e 76 65 72 73 65 | 20 74 61 62 6c 65 2e 20 | inverse| table. |
|00002ee0| 54 68 65 20 76 61 6c 75 | 65 20 69 6e 20 74 68 65 |The valu|e in the|
|00002ef0| 20 69 6e 76 65 72 73 65 | 20 74 61 62 6c 65 20 61 | inverse| table a|
|00002f00| 74 20 74 68 61 74 20 69 | 6e 64 65 78 20 69 73 20 |t that i|ndex is |
|00002f10| 74 68 65 20 70 69 78 65 | 6c 20 76 61 6c 75 65 20 |the pixe|l value |
|00002f20| 77 68 69 63 68 20 62 65 | 73 74 20 72 65 70 72 65 |which be|st repre|
|00002f30| 73 65 6e 74 73 20 74 68 | 61 74 20 63 6f 6c 6f 72 |sents th|at color|
|00002f40| 20 69 6e 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | in the |current |
|00002f50| 63 6f 6c 6f 72 20 65 6e | 76 69 72 6f 6e 6d 65 6e |color en|vironmen|
|00002f60| 74 2e 20 54 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |t. The n|umber of|
|00002f70| 20 62 69 74 73 20 6f 66 | 20 65 61 63 68 20 63 6f | bits of| each co|
|00002f80| 6d 70 6f 6e 65 6e 74 20 | 74 68 61 74 20 61 72 65 |mponent |that are|
|00002f90| 20 75 73 65 64 20 69 73 | 20 64 65 74 65 72 6d 69 | used is| determi|
|00002fa0| 6e 65 64 20 62 79 20 77 | 68 61 74 d5 73 20 63 61 |ned by w|hat.s ca|
|00002fb0| 6c 6c 65 64 20 74 68 65 | 20 d2 72 65 73 6f 6c 75 |lled the| .resolu|
|00002fc0| 74 69 6f 6e d3 20 6f 66 | 20 74 68 65 20 69 6e 76 |tion. of| the inv|
|00002fd0| 65 72 73 65 20 74 61 62 | 6c 65 2e 20 41 6c 6d 6f |erse tab|le. Almo|
|00002fe0| 73 74 20 61 6c 77 61 79 | 73 2c 20 74 68 65 20 72 |st alway|s, the r|
|00002ff0| 65 73 6f 6c 75 74 69 6f | 6e 20 6f 66 20 61 6e 20 |esolutio|n of an |
|00003000| 69 6e 76 65 72 73 65 20 | 74 61 62 6c 65 20 69 73 |inverse |table is|
|00003010| 20 66 6f 75 72 20 62 69 | 74 73 2c 20 6d 65 61 6e | four bi|ts, mean|
|00003020| 69 6e 67 20 74 68 65 20 | 6d 6f 73 74 20 73 69 67 |ing the |most sig|
|00003030| 6e 69 66 69 63 61 6e 74 | 20 66 6f 75 72 20 62 69 |nificant| four bi|
|00003040| 74 73 20 6f 66 20 65 61 | 63 68 20 63 6f 6d 70 6f |ts of ea|ch compo|
|00003050| 6e 65 6e 74 20 61 72 65 | 20 75 73 65 64 20 74 6f |nent are| used to|
|00003060| 20 66 6f 72 6d 20 74 68 | 65 20 69 6e 64 65 78 20 | form th|e index |
|00003070| 69 6e 74 6f 20 74 68 65 | 20 69 6e 76 65 72 73 65 |into the| inverse|
|00003080| 20 74 61 62 6c 65 2e 20 | 46 69 67 75 72 65 20 31 | table. |Figure 1|
|00003090| 20 73 68 6f 77 73 20 68 | 6f 77 20 61 6e 20 52 47 | shows h|ow an RG|
|000030a0| 42 43 6f 6c 6f 72 20 72 | 65 63 6f 72 64 20 69 73 |BColor r|ecord is|
|000030b0| 20 63 6f 6e 76 65 72 74 | 65 64 20 74 6f 20 61 6e | convert|ed to an|
|000030c0| 20 69 6e 64 65 78 20 69 | 6e 74 6f 20 61 6e 20 69 | index i|nto an i|
|000030d0| 6e 76 65 72 73 65 20 74 | 61 62 6c 65 20 77 68 65 |nverse t|able whe|
|000030e0| 6e 20 74 68 65 20 69 6e | 76 65 72 73 65 2d 74 61 |n the in|verse-ta|
|000030f0| 62 6c 65 20 72 65 73 6f | 6c 75 74 69 6f 6e 20 69 |ble reso|lution i|
|00003100| 73 20 66 6f 75 72 2e 0d | 46 69 67 75 72 65 20 31 |s four..|Figure 1|
|00003110| 20 20 43 6f 6e 76 65 72 | 73 69 6f 6e 20 6f 66 20 | Conver|sion of |
|00003120| 52 47 42 43 6f 6c 6f 72 | 20 52 65 63 6f 72 64 20 |RGBColor| Record |
|00003130| 74 6f 20 49 6e 76 65 72 | 73 65 2d 54 61 62 6c 65 |to Inver|se-Table|
|00003140| 20 49 6e 64 65 78 0d 54 | 68 65 20 73 61 6d 65 20 | Index.T|he same |
|00003150| 70 72 6f 63 65 73 73 20 | 69 73 20 75 73 65 64 20 |process |is used |
|00003160| 77 68 65 6e 20 5f 43 6f | 70 79 42 69 74 73 20 69 |when _Co|pyBits i|
|00003170| 73 20 63 61 6c 6c 65 64 | 20 77 69 74 68 20 61 6e |s called| with an|
|00003180| 20 69 6e 64 65 78 65 64 | 2d 63 6f 6c 6f 72 20 64 | indexed|-color d|
|00003190| 65 73 74 69 6e 61 74 69 | 6f 6e 2e 20 45 61 63 68 |estinati|on. Each|
|000031a0| 20 70 69 78 65 6c 20 69 | 6e 20 74 68 65 20 73 6f | pixel i|n the so|
|000031b0| 75 72 63 65 20 70 69 78 | 65 6c 20 69 6d 61 67 65 |urce pix|el image|
|000031c0| 20 69 73 20 63 6f 6e 76 | 65 72 74 65 64 20 74 6f | is conv|erted to|
|000031d0| 20 61 6e 20 52 47 42 43 | 6f 6c 6f 72 20 65 69 74 | an RGBC|olor eit|
|000031e0| 68 65 72 20 62 79 20 64 | 6f 69 6e 67 20 61 20 74 |her by d|oing a t|
|000031f0| 61 62 6c 65 20 6c 6f 6f | 6b 2d 75 70 20 6f 66 20 |able loo|k-up of |
|00003200| 74 68 65 20 73 6f 75 72 | 63 65 20 70 69 78 65 6c |the sour|ce pixel|
|00003210| 20 6d 61 70 d5 73 20 63 | 6f 6c 6f 72 20 74 61 62 | map.s c|olor tab|
|00003220| 6c 65 20 69 66 20 74 68 | 65 20 73 6f 75 72 63 65 |le if th|e source|
|00003230| 20 70 69 78 65 6c 20 69 | 6d 61 67 65 20 75 73 65 | pixel i|mage use|
|00003240| 73 20 69 6e 64 65 78 65 | 64 20 63 6f 6c 6f 72 73 |s indexe|d colors|
|00003250| 2c 20 6f 72 20 62 79 20 | 65 78 70 61 6e 64 69 6e |, or by |expandin|
|00003260| 67 20 74 68 65 20 70 69 | 78 65 6c 20 76 61 6c 75 |g the pi|xel valu|
|00003270| 65 20 74 6f 20 61 6e 20 | 52 47 42 43 6f 6c 6f 72 |e to an |RGBColor|
|00003280| 20 72 65 63 6f 72 64 20 | 69 66 20 74 68 65 20 73 | record |if the s|
|00003290| 6f 75 72 63 65 20 70 69 | 78 65 6c 20 69 6d 61 67 |ource pi|xel imag|
|000032a0| 65 20 75 73 65 73 20 64 | 69 72 65 63 74 20 63 6f |e uses d|irect co|
|000032b0| 6c 6f 72 73 2e 20 54 68 | 65 20 72 65 73 75 6c 74 |lors. Th|e result|
|000032c0| 69 6e 67 20 52 47 42 43 | 6f 6c 6f 72 20 69 73 20 |ing RGBC|olor is |
|000032d0| 74 68 65 6e 20 75 73 65 | 64 20 74 6f 20 6c 6f 6f |then use|d to loo|
|000032e0| 6b 20 75 70 20 61 20 70 | 69 78 65 6c 20 76 61 6c |k up a p|ixel val|
|000032f0| 75 65 20 69 6e 20 74 68 | 65 20 69 6e 76 65 72 73 |ue in th|e invers|
|00003300| 65 20 74 61 62 6c 65 20 | 6f 66 20 74 68 65 20 63 |e table |of the c|
|00003310| 75 72 72 65 6e 74 20 47 | 44 65 76 69 63 65 2c 20 |urrent G|Device, |
|00003320| 61 6e 64 20 74 68 69 73 | 20 70 69 78 65 6c 20 76 |and this| pixel v|
|00003330| 61 6c 75 65 20 69 73 20 | 70 75 74 20 69 6e 74 6f |alue is |put into|
|00003340| 20 74 68 65 20 64 65 73 | 74 69 6e 61 74 69 6f 6e | the des|tination|
|00003350| 20 70 69 78 65 6c 20 69 | 6d 61 67 65 2e 0d 49 66 | pixel i|mage..If|
|00003360| 20 79 6f 75 20 73 70 65 | 63 69 66 79 20 61 20 63 | you spe|cify a c|
|00003370| 6f 6c 6f 72 20 69 6e 20 | 61 20 64 69 72 65 63 74 |olor in |a direct|
|00003380| 2d 63 6f 6c 6f 72 20 65 | 6e 76 69 72 6f 6e 6d 65 |-color e|nvironme|
|00003390| 6e 74 2c 20 74 68 65 6e | 20 74 68 65 20 72 65 73 |nt, then| the res|
|000033a0| 75 6c 74 69 6e 67 20 52 | 47 42 43 6f 6c 6f 72 20 |ulting R|GBColor |
|000033b0| 69 73 20 63 6f 6e 76 65 | 72 74 65 64 20 74 6f 20 |is conve|rted to |
|000033c0| 61 20 64 69 72 65 63 74 | 20 70 69 78 65 6c 20 76 |a direct| pixel v|
|000033d0| 61 6c 75 65 20 62 79 20 | 74 68 65 20 70 72 6f 63 |alue by |the proc|
|000033e0| 65 73 73 65 73 20 74 68 | 61 74 20 61 72 65 20 73 |esses th|at are s|
|000033f0| 68 6f 77 6e 20 6f 6e 20 | 70 61 67 65 73 20 31 37 |hown on |pages 17|
|00003400| 2d 36 20 74 68 72 6f 75 | 67 68 20 31 37 2d 39 20 |-6 throu|gh 17-9 |
|00003410| 6f 66 20 74 68 65 20 d2 | 43 6f 6c 6f 72 20 51 75 |of the .|Color Qu|
|00003420| 69 63 6b 44 72 61 77 d3 | 20 63 68 61 70 74 65 72 |ickDraw.| chapter|
|00003430| 20 6f 66 20 49 6e 73 69 | 64 65 20 4d 61 63 69 6e | of Insi|de Macin|
|00003440| 74 6f 73 68 20 56 6f 6c | 75 6d 65 20 56 49 2e 0d |tosh Vol|ume VI..|
|00003450| 55 73 75 61 6c 6c 79 2c | 20 69 6e 76 65 72 73 65 |Usually,| inverse|
|00003460| 2d 74 61 62 6c 65 20 6c | 6f 6f 6b 2d 75 70 20 69 |-table l|ook-up i|
|00003470| 6e 76 6f 6c 76 65 73 20 | 61 6e 20 65 78 74 72 61 |nvolves |an extra|
|00003480| 20 73 74 65 70 20 74 6f | 20 66 69 6e 64 20 77 68 | step to| find wh|
|00003490| 61 74 20 61 72 65 20 63 | 61 6c 6c 65 64 20 d2 68 |at are c|alled .h|
|000034a0| 69 64 64 65 6e 20 63 6f | 6c 6f 72 73 d3 20 75 73 |idden co|lors. us|
|000034b0| 69 6e 67 20 70 72 6f 70 | 72 69 65 74 61 72 79 20 |ing prop|rietary |
|000034c0| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 74 68 61 74 |informat|ion that|
|000034d0| d5 73 20 73 74 6f 72 65 | 64 20 61 74 20 74 68 65 |.s store|d at the|
|000034e0| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 69 6e 76 65 | end of |the inve|
|000034f0| 72 73 65 20 74 61 62 6c | 65 2e 20 57 69 74 68 20 |rse tabl|e. With |
|00003500| 61 6e 20 69 6e 76 65 72 | 73 65 2d 74 61 62 6c 65 |an inver|se-table|
|00003510| 20 72 65 73 6f 6c 75 74 | 69 6f 6e 20 6f 66 20 66 | resolut|ion of f|
|00003520| 6f 75 72 2c 20 6f 6e 6c | 79 20 31 36 20 73 68 61 |our, onl|y 16 sha|
|00003530| 64 65 73 20 6f 66 20 61 | 6e 79 20 70 61 72 74 69 |des of a|ny parti|
|00003540| 63 75 6c 61 72 20 63 6f | 6d 70 6f 6e 65 6e 74 20 |cular co|mponent |
|00003550| 63 61 6e 20 62 65 20 64 | 69 73 74 69 6e 67 75 69 |can be d|istingui|
|00003560| 73 68 65 64 2c 20 61 6e | 64 20 74 68 61 74 d5 73 |shed, an|d that.s|
|00003570| 20 6f 66 74 65 6e 20 6e | 6f 74 20 65 6e 6f 75 67 | often n|ot enoug|
|00003580| 68 2e 20 41 6e 20 69 6e | 76 65 72 73 65 20 74 61 |h. An in|verse ta|
|00003590| 62 6c 65 20 77 69 74 68 | 20 61 20 72 65 73 6f 6c |ble with| a resol|
|000035a0| 75 74 69 6f 6e 20 6f 66 | 20 66 69 76 65 20 69 73 |ution of| five is|
|000035b0| 20 6d 75 63 68 20 6c 61 | 72 67 65 72 2c 20 62 75 | much la|rger, bu|
|000035c0| 74 20 69 74 20 73 74 69 | 6c 6c 20 6f 6e 6c 79 20 |t it sti|ll only |
|000035d0| 67 69 76 65 73 20 79 6f | 75 20 33 32 20 73 68 61 |gives yo|u 32 sha|
|000035e0| 64 65 73 20 6f 66 20 61 | 6e 79 20 63 6f 6d 70 6f |des of a|ny compo|
|000035f0| 6e 65 6e 74 2e 20 48 69 | 64 64 65 6e 20 63 6f 6c |nent. Hi|dden col|
|00003600| 6f 72 73 20 61 72 65 20 | 6c 6f 6f 6b 65 64 20 75 |ors are |looked u|
|00003610| 70 20 61 66 74 65 72 20 | 74 68 65 20 6e 6f 72 6d |p after |the norm|
|00003620| 61 6c 20 69 6e 76 65 72 | 73 65 2d 74 61 62 6c 65 |al inver|se-table|
|00003630| 20 6c 6f 6f 6b 2d 75 70 | 20 74 6f 20 67 69 76 65 | look-up| to give|
|00003640| 20 61 20 6d 75 63 68 20 | 6d 6f 72 65 20 61 63 63 | a much |more acc|
|00003650| 75 72 61 74 65 20 72 65 | 70 72 65 73 65 6e 74 61 |urate re|presenta|
|00003660| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 73 70 65 63 |tion of |the spec|
|00003670| 69 66 69 65 64 20 63 6f | 6c 6f 72 20 69 6e 20 74 |ified co|lor in t|
|00003680| 68 65 20 63 75 72 72 65 | 6e 74 20 63 6f 6c 6f 72 |he curre|nt color|
|00003690| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 20 74 68 61 | environ|ment tha|
|000036a0| 6e 20 74 68 65 20 69 6e | 76 65 72 73 65 2d 74 61 |n the in|verse-ta|
|000036b0| 62 6c 65 20 6c 6f 6f 6b | 2d 75 70 20 61 6c 6f 6e |ble look|-up alon|
|000036c0| 65 20 63 61 6e 20 70 72 | 6f 64 75 63 65 2e 20 53 |e can pr|oduce. S|
|000036d0| 6f 6d 65 74 69 6d 65 73 | 2c 20 6d 6f 73 74 20 6e |ometimes|, most n|
|000036e0| 6f 74 61 62 6c 79 20 77 | 68 65 6e 20 74 68 65 20 |otably w|hen the |
|000036f0| 61 72 69 74 68 6d 65 74 | 69 63 20 74 72 61 6e 73 |arithmet|ic trans|
|00003700| 66 65 72 20 6d 6f 64 65 | 73 20 61 72 65 20 75 73 |fer mode|s are us|
|00003710| 65 64 20 6f 72 20 69 66 | 20 64 69 74 68 65 72 69 |ed or if| ditheri|
|00003720| 6e 67 20 69 73 20 75 73 | 65 64 2c 20 74 68 65 20 |ng is us|ed, the |
|00003730| 68 69 64 64 65 6e 20 63 | 6f 6c 6f 72 73 20 61 72 |hidden c|olors ar|
|00003740| 65 20 69 67 6e 6f 72 65 | 64 2e 0d 57 68 65 6e 20 |e ignore|d..When |
|00003750| 61 20 6e 65 77 20 63 6f | 6c 6f 72 20 74 61 62 6c |a new co|lor tabl|
|00003760| 65 20 69 73 20 61 73 73 | 69 67 6e 65 64 20 74 6f |e is ass|igned to|
|00003770| 20 61 20 50 69 78 4d 61 | 70 20 6f 72 20 77 68 65 | a PixMa|p or whe|
|00003780| 6e 20 69 74 73 20 65 78 | 69 73 74 69 6e 67 20 63 |n its ex|isting c|
|00003790| 6f 6c 6f 72 20 74 61 62 | 6c 65 20 69 73 20 6d 6f |olor tab|le is mo|
|000037a0| 64 69 66 69 65 64 2c 20 | 74 68 65 6e 20 61 20 6e |dified, |then a n|
|000037b0| 65 77 20 63 6f 72 72 65 | 73 70 6f 6e 64 69 6e 67 |ew corre|sponding|
|000037c0| 20 69 6e 76 65 72 73 65 | 20 74 61 62 6c 65 20 73 | inverse| table s|
|000037d0| 68 6f 75 6c 64 20 62 65 | 20 67 65 6e 65 72 61 74 |hould be| generat|
|000037e0| 65 64 20 66 6f 72 20 74 | 68 65 20 47 44 65 76 69 |ed for t|he GDevi|
|000037f0| 63 65 20 74 68 61 74 d5 | 6c 6c 20 62 65 20 75 73 |ce that.|ll be us|
|00003800| 65 64 20 77 68 65 6e 20 | 64 72 61 77 69 6e 67 20 |ed when |drawing |
|00003810| 69 6e 74 6f 20 74 68 61 | 74 20 65 6e 76 69 72 6f |into tha|t enviro|
|00003820| 6e 6d 65 6e 74 2e 20 4e | 6f 72 6d 61 6c 6c 79 2c |nment. N|ormally,|
|00003830| 20 74 68 69 73 20 68 61 | 70 70 65 6e 73 20 61 75 | this ha|ppens au|
|00003840| 74 6f 6d 61 74 69 63 61 | 6c 6c 79 20 77 69 74 68 |tomatica|lly with|
|00003850| 6f 75 74 20 79 6f 75 20 | 68 61 76 69 6e 67 20 74 |out you |having t|
|00003860| 6f 20 64 6f 20 61 6e 79 | 20 6d 6f 72 65 20 74 68 |o do any| more th|
|00003870| 61 6e 20 69 6e 66 6f 72 | 6d 20 43 6f 6c 6f 72 20 |an infor|m Color |
|00003880| 51 75 69 63 6b 44 72 61 | 77 20 6f 66 20 74 68 65 |QuickDra|w of the|
|00003890| 20 63 68 61 6e 67 65 2e | 20 54 68 69 73 20 69 73 | change.| This is|
|000038a0| 20 64 65 73 63 72 69 62 | 65 64 20 69 6e 20 6d 6f | describ|ed in mo|
|000038b0| 72 65 20 64 65 74 61 69 | 6c 20 69 6e 20 20 d2 43 |re detai|l in .C|
|000038c0| 68 61 6e 67 69 6e 67 20 | 74 68 65 20 4f 66 66 2d |hanging |the Off-|
|000038d0| 53 63 72 65 65 6e 20 43 | 6f 6c 6f 72 20 54 61 62 |Screen C|olor Tab|
|000038e0| 6c 65 d3 20 20 6c 61 74 | 65 72 20 69 6e 20 74 68 |le. lat|er in th|
|000038f0| 69 73 20 4e 6f 74 65 2e | 0d 47 72 61 70 68 69 63 |is Note.|.Graphic|
|00003900| 73 20 64 65 76 69 63 65 | 73 20 61 72 65 20 64 6f |s device|s are do|
|00003910| 63 75 6d 65 6e 74 65 64 | 20 69 6e 20 74 68 65 20 |cumented| in the |
|00003920| d2 47 72 61 70 68 69 63 | 73 20 44 65 76 69 63 65 |.Graphic|s Device|
|00003930| 73 d3 20 63 68 61 70 74 | 65 72 20 6f 66 20 49 6e |s. chapt|er of In|
|00003940| 73 69 64 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 56 |side Mac|intosh V|
|00003950| 6f 6c 75 6d 65 20 56 49 | 20 77 68 69 63 68 20 73 |olume VI| which s|
|00003960| 75 70 65 72 73 65 64 65 | 73 20 74 68 65 20 d2 47 |upersede|s the .G|
|00003970| 72 61 70 68 69 63 73 20 | 44 65 76 69 63 65 73 d3 |raphics |Devices.|
|00003980| 20 63 68 61 70 74 65 72 | 20 6f 66 20 49 6e 73 69 | chapter| of Insi|
|00003990| 64 65 20 4d 61 63 69 6e | 74 6f 73 68 20 56 6f 6c |de Macin|tosh Vol|
|000039a0| 75 6d 65 20 56 2e 20 54 | 68 65 79 d5 72 65 20 61 |ume V. T|hey.re a|
|000039b0| 6c 73 6f 20 64 69 73 63 | 75 73 73 65 64 20 69 6e |lso disc|ussed in|
|000039c0| 20 74 68 65 20 d2 47 72 | 61 70 68 69 63 73 20 4f | the .Gr|aphics O|
|000039d0| 76 65 72 76 69 65 77 d3 | 20 63 68 61 70 74 65 72 |verview.| chapter|
|000039e0| 20 6f 66 20 49 6e 73 69 | 64 65 20 4d 61 63 69 6e | of Insi|de Macin|
|000039f0| 74 6f 73 68 20 56 6f 6c | 75 6d 65 20 56 49 2c 20 |tosh Vol|ume VI, |
|00003a00| 70 61 67 65 73 20 31 36 | 2d 31 33 20 74 68 72 6f |pages 16|-13 thro|
|00003a10| 75 67 68 20 31 36 2d 31 | 34 2e 20 54 68 65 20 69 |ugh 16-1|4. The i|
|00003a20| 6e 76 65 72 73 65 2d 74 | 61 62 6c 65 20 6d 65 63 |nverse-t|able mec|
|00003a30| 68 61 6e 69 73 6d 20 69 | 73 20 64 65 73 63 72 69 |hanism i|s descri|
|00003a40| 62 65 64 20 69 6e 20 74 | 68 65 20 d2 43 6f 6c 6f |bed in t|he .Colo|
|00003a50| 72 20 4d 61 6e 61 67 65 | 72 d3 20 63 68 61 70 74 |r Manage|r. chapt|
|00003a60| 65 72 20 6f 66 20 49 6e | 73 69 64 65 20 4d 61 63 |er of In|side Mac|
|00003a70| 69 6e 74 6f 73 68 20 56 | 6f 6c 75 6d 65 20 56 2c |intosh V|olume V,|
|00003a80| 20 70 61 67 65 73 20 31 | 33 37 20 74 68 72 6f 75 | pages 1|37 throu|
|00003a90| 67 68 20 31 33 39 2e 0d | 41 6c 6c 20 54 6f 67 65 |gh 139..|All Toge|
|00003aa0| 74 68 65 72 20 4e 6f 77 | 0d 54 68 65 72 65 20 61 |ther Now|.There a|
|00003ab0| 72 65 20 61 20 6c 6f 74 | 20 6f 66 20 64 69 66 66 |re a lot| of diff|
|00003ac0| 65 72 65 6e 74 20 77 61 | 79 73 20 74 6f 20 70 75 |erent wa|ys to pu|
|00003ad0| 74 20 74 68 65 20 74 68 | 72 65 65 20 73 74 72 75 |t the th|ree stru|
|00003ae0| 63 74 75 72 65 73 20 74 | 6f 67 65 74 68 65 72 2c |ctures t|ogether,|
|00003af0| 20 61 6e 64 20 74 68 69 | 73 20 4e 6f 74 65 20 64 | and thi|s Note d|
|00003b00| 69 73 63 75 73 73 65 73 | 20 74 68 65 20 61 72 63 |iscusses| the arc|
|00003b10| 68 69 74 65 63 74 75 72 | 65 20 74 68 61 74 d5 73 |hitectur|e that.s|
|00003b20| 20 73 68 6f 77 6e 20 69 | 6e 20 46 69 67 75 72 65 | shown i|n Figure|
|00003b30| 20 32 2e 20 54 68 69 73 | 20 61 72 63 68 69 74 65 | 2. This| archite|
|00003b40| 63 74 75 72 65 20 69 73 | 20 20 75 73 65 66 75 6c |cture is| useful|
|00003b50| 20 77 68 65 6e 20 79 6f | 75 20 77 61 6e 74 20 61 | when yo|u want a|
|00003b60| 20 73 69 6d 70 6c 65 2c | 20 61 74 6f 6d 69 63 2c | simple,| atomic,|
|00003b70| 20 6f 66 66 2d 73 63 72 | 65 65 6e 20 67 72 61 70 | off-scr|een grap|
|00003b80| 68 69 63 73 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |hics env|ironment|
|00003b90| 2e 0d 46 69 67 75 72 65 | 20 32 20 20 52 65 6c 61 |..Figure| 2 Rela|
|00003ba0| 74 69 6f 6e 73 68 69 70 | 73 20 42 65 74 77 65 65 |tionship|s Betwee|
|00003bb0| 6e 20 53 74 72 75 63 74 | 75 72 65 73 20 66 6f 72 |n Struct|ures for|
|00003bc0| 20 4f 66 66 2d 53 63 72 | 65 65 6e 20 44 72 61 77 | Off-Scr|een Draw|
|00003bd0| 69 6e 67 0d 4e 6f 74 69 | 63 65 20 74 68 61 74 20 |ing.Noti|ce that |
|00003be0| 74 68 65 72 65 d5 73 20 | 6e 6f 20 77 61 79 20 74 |there.s |no way t|
|00003bf0| 6f 20 67 65 74 20 74 6f | 20 74 68 65 20 47 44 65 |o get to| the GDe|
|00003c00| 76 69 63 65 20 66 72 6f | 6d 20 74 68 65 20 43 47 |vice fro|m the CG|
|00003c10| 72 61 66 50 6f 72 74 2c | 20 6e 6f 72 20 69 73 20 |rafPort,| nor is |
|00003c20| 74 68 65 72 65 20 61 20 | 77 61 79 20 74 6f 20 67 |there a |way to g|
|00003c30| 65 74 20 74 6f 20 74 68 | 65 20 43 47 72 61 66 50 |et to th|e CGrafP|
|00003c40| 6f 72 74 20 66 72 6f 6d | 20 74 68 65 20 47 44 65 |ort from| the GDe|
|00003c50| 76 69 63 65 2c 20 74 68 | 6f 75 67 68 20 74 68 65 |vice, th|ough the|
|00003c60| 20 50 69 78 4d 61 70 20 | 63 61 6e 20 62 65 20 66 | PixMap |can be f|
|00003c70| 6f 75 6e 64 20 74 68 72 | 6f 75 67 68 20 65 69 74 |ound thr|ough eit|
|00003c80| 68 65 72 20 6f 6e 65 2e | 20 59 6f 75 72 20 61 70 |her one.| Your ap|
|00003c90| 70 6c 69 63 61 74 69 6f | 6e 20 6d 75 73 74 20 6b |plicatio|n must k|
|00003ca0| 65 65 70 20 74 72 61 63 | 6b 20 6f 66 20 62 6f 74 |eep trac|k of bot|
|00003cb0| 68 20 74 68 65 20 43 47 | 72 61 66 50 6f 72 74 20 |h the CG|rafPort |
|00003cc0| 61 6e 64 20 74 68 65 20 | 47 44 65 76 69 63 65 2e |and the |GDevice.|
|00003cd0| 0d 42 75 69 6c 64 69 6e | 67 20 74 68 65 20 42 6c |.Buildin|g the Bl|
|00003ce0| 6f 63 6b 73 0d 41 73 20 | 77 69 74 68 20 6a 75 73 |ocks.As |with jus|
|00003cf0| 74 20 61 62 6f 75 74 20 | 61 6e 79 20 61 6c 67 6f |t about |any algo|
|00003d00| 72 69 74 68 6d 2c 20 74 | 68 65 72 65 20 61 72 65 |rithm, t|here are|
|00003d10| 20 6d 61 6e 79 20 77 61 | 79 73 20 74 6f 20 70 75 | many wa|ys to pu|
|00003d20| 74 20 74 68 65 20 64 69 | 66 66 65 72 65 6e 74 20 |t the di|fferent |
|00003d30| 73 74 72 75 63 74 75 72 | 65 73 20 74 6f 67 65 74 |structur|es toget|
|00003d40| 68 65 72 20 74 68 61 74 | 20 66 6f 72 6d 20 61 6e |her that| form an|
|00003d50| 20 6f 66 66 2d 73 63 72 | 65 65 6e 20 67 72 61 70 | off-scr|een grap|
|00003d60| 68 69 63 73 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |hics env|ironment|
|00003d70| 2e 20 54 68 69 73 20 73 | 65 63 74 69 6f 6e 20 63 |. This s|ection c|
|00003d80| 6f 76 65 72 73 20 6a 75 | 73 74 20 6f 6e 65 20 77 |overs ju|st one w|
|00003d90| 61 79 20 74 6f 20 62 75 | 69 6c 64 20 74 68 65 20 |ay to bu|ild the |
|00003da0| 61 72 63 68 69 74 65 63 | 74 75 72 65 20 74 68 61 |architec|ture tha|
|00003db0| 74 d5 73 20 73 68 6f 77 | 6e 20 69 6e 20 46 69 67 |t.s show|n in Fig|
|00003dc0| 75 72 65 20 32 2e 0d 42 | 75 69 6c 64 69 6e 67 20 |ure 2..B|uilding |
|00003dd0| 74 68 65 20 43 47 72 61 | 66 50 6f 72 74 0d 54 68 |the CGra|fPort.Th|
|00003de0| 65 20 43 47 72 61 66 50 | 6f 72 74 20 73 74 72 75 |e CGrafP|ort stru|
|00003df0| 63 74 75 72 65 20 69 73 | 20 74 68 65 20 65 61 73 |cture is| the eas|
|00003e00| 69 65 73 74 20 6f 6e 65 | 20 74 6f 20 70 75 74 20 |iest one| to put |
|00003e10| 74 6f 67 65 74 68 65 72 | 20 62 65 63 61 75 73 65 |together| because|
|00003e20| 20 74 68 65 20 5f 4f 70 | 65 6e 43 50 6f 72 74 20 | the _Op|enCPort |
|00003e30| 72 6f 75 74 69 6e 65 20 | 69 6e 69 74 69 61 6c 69 |routine |initiali|
|00003e40| 7a 65 73 20 73 6f 20 6d | 61 6e 79 20 6f 66 20 74 |zes so m|any of t|
|00003e50| 68 65 20 66 69 65 6c 64 | 73 20 6f 66 20 74 68 65 |he field|s of the|
|00003e60| 20 43 47 72 61 66 50 6f | 72 74 20 73 74 72 75 63 | CGrafPo|rt struc|
|00003e70| 74 75 72 65 20 66 6f 72 | 20 79 6f 75 2e 20 49 74 |ture for| you. It|
|00003e80| 20 61 6c 73 6f 20 61 6c | 6c 6f 63 61 74 65 73 20 | also al|locates |
|00003e90| 61 6e 64 20 69 6e 69 74 | 69 61 6c 69 7a 65 73 20 |and init|ializes |
|00003ea0| 74 68 65 20 73 74 72 75 | 63 74 75 72 65 73 20 74 |the stru|ctures t|
|00003eb0| 68 61 74 20 61 72 65 20 | 61 74 74 61 63 68 65 64 |hat are |attached|
|00003ec0| 20 74 6f 20 65 76 65 72 | 79 20 43 47 72 61 66 50 | to ever|y CGrafP|
|00003ed0| 6f 72 74 2c 20 73 75 63 | 68 20 61 73 20 74 68 65 |ort, suc|h as the|
|00003ee0| 20 76 69 73 52 67 6e 2c | 20 63 6c 69 70 52 67 6e | visRgn,| clipRgn|
|00003ef0| 2c 20 67 72 61 66 56 61 | 72 73 20 68 61 6e 64 6c |, grafVa|rs handl|
|00003f00| 65 2c 20 61 6e 64 20 73 | 6f 20 66 6f 72 74 68 2e |e, and s|o forth.|
|00003f10| 20 4d 6f 73 74 20 6f 66 | 20 74 68 65 73 65 20 61 | Most of| these a|
|00003f20| 72 65 20 69 6e 69 74 69 | 61 6c 69 7a 65 64 20 77 |re initi|alized w|
|00003f30| 69 74 68 20 76 61 6c 75 | 65 73 20 74 68 61 74 20 |ith valu|es that |
|00003f40| 61 72 65 20 66 69 6e 65 | 20 66 6f 72 20 67 65 6e |are fine| for gen|
|00003f50| 65 72 61 6c 20 70 75 72 | 70 6f 73 65 73 2c 20 62 |eral pur|poses, b|
|00003f60| 75 74 20 74 68 65 20 76 | 69 73 52 67 6e 2c 20 63 |ut the v|isRgn, c|
|00003f70| 6c 69 70 52 67 6e 2c 20 | 61 6e 64 20 70 6f 72 74 |lipRgn, |and port|
|00003f80| 52 65 63 74 20 66 69 65 | 6c 64 73 20 73 68 6f 75 |Rect fie|lds shou|
|00003f90| 6c 64 20 62 65 20 73 65 | 74 20 74 6f 20 74 68 65 |ld be se|t to the|
|00003fa0| 20 64 65 73 69 72 65 64 | 20 62 6f 75 6e 64 61 72 | desired| boundar|
|00003fb0| 79 20 72 65 63 74 61 6e | 67 6c 65 20 6f 66 20 74 |y rectan|gle of t|
|00003fc0| 68 65 20 6f 66 66 2d 73 | 63 72 65 65 6e 20 67 72 |he off-s|creen gr|
|00003fd0| 61 70 68 69 63 73 20 65 | 6e 76 69 72 6f 6e 6d 65 |aphics e|nvironme|
|00003fe0| 6e 74 2e 20 57 68 61 74 | 20 66 6f 6c 6c 6f 77 73 |nt. What| follows|
|00003ff0| 20 69 73 20 61 6e 20 6f | 76 65 72 76 69 65 77 20 | is an o|verview |
|00004000| 6f 66 20 65 61 63 68 20 | 6f 66 20 74 68 65 20 66 |of each |of the f|
|00004010| 69 65 6c 64 73 20 74 68 | 61 74 20 79 6f 75 20 68 |ields th|at you h|
|00004020| 61 76 65 20 74 6f 20 77 | 6f 72 72 79 20 61 62 6f |ave to w|orry abo|
|00004030| 75 74 20 77 68 65 6e 20 | 79 6f 75 d5 72 65 20 73 |ut when |you.re s|
|00004040| 65 74 74 69 6e 67 20 75 | 70 20 61 20 43 47 72 61 |etting u|p a CGra|
|00004050| 66 50 6f 72 74 20 66 6f | 72 20 64 72 61 77 69 6e |fPort fo|r drawin|
|00004060| 67 20 6f 66 66 20 73 63 | 72 65 65 6e 2e 0d 70 6f |g off sc|reen..po|
|00004070| 72 74 50 69 78 4d 61 70 | 09 68 61 6e 64 6c 65 20 |rtPixMap|.handle |
|00004080| 74 6f 20 74 68 65 20 6f | 66 66 2d 73 63 72 65 65 |to the o|ff-scree|
|00004090| 6e 20 50 69 78 4d 61 70 | 2e 20 5f 4f 70 65 6e 43 |n PixMap|. _OpenC|
|000040a0| 50 6f 72 74 20 69 6e 69 | 74 69 61 6c 69 7a 65 73 |Port ini|tializes|
|000040b0| 20 74 68 69 73 20 66 69 | 65 6c 64 20 74 6f 20 61 | this fi|eld to a|
|000040c0| 20 63 6f 70 79 20 6f 66 | 20 74 68 65 20 50 69 78 | copy of| the Pix|
|000040d0| 4d 61 70 20 74 68 61 74 | d5 73 20 61 74 74 61 63 |Map that|.s attac|
|000040e0| 68 65 64 20 74 6f 20 74 | 68 65 20 67 64 50 4d 61 |hed to t|he gdPMa|
|000040f0| 70 20 66 69 65 6c 64 20 | 6f 66 20 74 68 65 20 63 |p field |of the c|
|00004100| 75 72 72 65 6e 74 20 47 | 44 65 76 69 63 65 2e 20 |urrent G|Device. |
|00004110| 41 6e 20 6f 76 65 72 76 | 69 65 77 20 6f 66 20 73 |An overv|iew of s|
|00004120| 65 74 74 69 6e 67 20 75 | 70 20 74 68 69 73 20 50 |etting u|p this P|
|00004130| 69 78 4d 61 70 20 66 6f | 72 20 64 72 61 77 69 6e |ixMap fo|r drawin|
|00004140| 67 20 6f 66 66 20 73 63 | 72 65 65 6e 20 69 73 20 |g off sc|reen is |
|00004150| 67 69 76 65 6e 20 69 6e | 20 20 d2 42 75 69 6c 64 |given in| .Build|
|00004160| 69 6e 67 20 74 68 65 20 | 50 69 78 4d 61 70 d3 20 |ing the |PixMap. |
|00004170| 6c 61 74 65 72 20 69 6e | 20 74 68 69 73 20 4e 6f |later in| this No|
|00004180| 74 65 2e 0d 70 6f 72 74 | 52 65 63 74 09 73 70 65 |te..port|Rect.spe|
|00004190| 63 69 66 69 65 73 20 74 | 68 65 20 72 65 63 74 61 |cifies t|he recta|
|000041a0| 6e 67 75 6c 61 72 20 61 | 72 65 61 20 6f 66 20 74 |ngular a|rea of t|
|000041b0| 68 65 20 61 73 73 6f 63 | 69 61 74 65 64 20 70 69 |he assoc|iated pi|
|000041c0| 78 65 6c 20 69 6d 61 67 | 65 20 74 68 61 74 20 74 |xel imag|e that t|
|000041d0| 68 69 73 20 43 47 72 61 | 66 50 6f 72 74 20 63 6f |his CGra|fPort co|
|000041e0| 6e 74 72 6f 6c 73 2e 20 | 54 68 69 73 20 66 69 65 |ntrols. |This fie|
|000041f0| 6c 64 20 73 68 6f 75 6c | 64 20 62 65 20 73 65 74 |ld shoul|d be set|
|00004200| 20 74 6f 20 74 68 65 20 | 64 65 73 69 72 65 64 20 | to the |desired |
|00004210| 72 65 63 74 61 6e 67 75 | 6c 61 72 20 61 72 65 61 |rectangu|lar area|
|00004220| 20 6f 66 20 74 68 65 20 | 6f 66 66 2d 73 63 72 65 | of the |off-scre|
|00004230| 65 6e 20 69 6d 61 67 65 | 20 62 65 63 61 75 73 65 |en image| because|
|00004240| 20 5f 4f 70 65 6e 43 50 | 6f 72 74 20 64 6f 65 73 | _OpenCP|ort does|
|00004250| 6e d5 74 20 6e 65 63 65 | 73 73 61 72 69 6c 79 20 |n.t nece|ssarily |
|00004260| 69 6e 69 74 69 61 6c 69 | 7a 65 20 69 74 20 74 6f |initiali|ze it to|
|00004270| 20 74 68 69 73 20 73 69 | 7a 65 2e 20 55 73 75 61 | this si|ze. Usua|
|00004280| 6c 6c 79 2c 20 74 68 65 | 20 74 6f 70 2d 6c 65 66 |lly, the| top-lef|
|00004290| 74 20 63 6f 72 6e 65 72 | 20 6f 66 20 74 68 69 73 |t corner| of this|
|000042a0| 20 72 65 63 74 61 6e 67 | 6c 65 20 68 61 73 20 74 | rectang|le has t|
|000042b0| 68 65 20 63 6f 6f 72 64 | 69 6e 61 74 65 73 20 28 |he coord|inates (|
|000042c0| 30 2c 20 30 29 2c 20 62 | 75 74 20 6e 6f 74 20 6e |0, 0), b|ut not n|
|000042d0| 65 63 65 73 73 61 72 69 | 6c 79 20 73 6f 2e 0d 76 |ecessari|ly so..v|
|000042e0| 69 73 52 67 6e 09 68 61 | 6e 64 6c 65 20 74 6f 20 |isRgn.ha|ndle to |
|000042f0| 74 68 65 20 72 65 67 69 | 6f 6e 20 74 68 61 74 20 |the regi|on that |
|00004300| 73 70 65 63 69 66 69 65 | 73 20 74 68 65 20 76 69 |specifie|s the vi|
|00004310| 73 69 62 6c 65 20 61 72 | 65 61 20 69 6e 74 6f 20 |sible ar|ea into |
|00004320| 77 68 69 63 68 20 79 6f | 75 20 63 61 6e 20 64 72 |which yo|u can dr|
|00004330| 61 77 2e 20 5f 4f 70 65 | 6e 43 50 6f 72 74 20 64 |aw. _Ope|nCPort d|
|00004340| 6f 65 73 6e d5 74 20 6e | 65 63 65 73 73 61 72 69 |oesn.t n|ecessari|
|00004350| 6c 79 20 69 6e 69 74 69 | 61 6c 69 7a 65 20 69 74 |ly initi|alize it|
|00004360| 20 74 6f 20 74 68 65 20 | 73 69 7a 65 20 6f 66 20 | to the |size of |
|00004370| 74 68 65 20 6f 66 66 2d | 73 63 72 65 65 6e 20 69 |the off-|screen i|
|00004380| 6d 61 67 65 2c 20 73 6f | 20 69 74 20 73 68 6f 75 |mage, so| it shou|
|00004390| 6c 64 20 62 65 20 73 65 | 74 20 74 6f 20 74 68 65 |ld be se|t to the|
|000043a0| 20 73 61 6d 65 20 73 69 | 7a 65 20 61 6e 64 20 63 | same si|ze and c|
|000043b0| 6f 6f 72 64 69 6e 61 74 | 65 73 20 61 73 20 74 68 |oordinat|es as th|
|000043c0| 65 20 70 6f 72 74 52 65 | 63 74 20 61 6e 64 20 6c |e portRe|ct and l|
|000043d0| 65 66 74 20 61 74 20 74 | 68 61 74 2e 20 54 68 69 |eft at t|hat. Thi|
|000043e0| 73 20 66 69 65 6c 64 20 | 69 73 20 6d 6f 72 65 20 |s field |is more |
|000043f0| 69 6d 70 6f 72 74 61 6e | 74 20 66 6f 72 20 77 69 |importan|t for wi|
|00004400| 6e 64 6f 77 73 20 62 65 | 63 61 75 73 65 20 70 61 |ndows be|cause pa|
|00004410| 72 74 73 20 6f 66 20 74 | 68 65 6d 20 63 61 6e 20 |rts of t|hem can |
|00004420| 62 65 20 68 69 64 64 65 | 6e 20 62 79 20 6f 74 68 |be hidde|n by oth|
|00004430| 65 72 20 77 69 6e 64 6f | 77 73 2e 0d 63 6c 69 70 |er windo|ws..clip|
|00004440| 52 67 6e 09 68 61 6e 64 | 6c 65 20 74 6f 20 74 68 |Rgn.hand|le to th|
|00004450| 65 20 72 65 67 69 6f 6e | 20 74 68 61 74 20 73 70 |e region| that sp|
|00004460| 65 63 69 66 69 65 73 20 | 74 68 65 20 6c 6f 67 69 |ecifies |the logi|
|00004470| 63 61 6c 20 61 72 65 61 | 20 69 6e 74 6f 20 77 68 |cal area| into wh|
|00004480| 69 63 68 20 79 6f 75 20 | 63 61 6e 20 64 72 61 77 |ich you |can draw|
|00004490| 2e 20 5f 4f 70 65 6e 43 | 50 6f 72 74 20 69 6e 69 |. _OpenC|Port ini|
|000044a0| 74 69 61 6c 69 7a 65 73 | 20 69 74 20 74 6f 20 63 |tializes| it to c|
|000044b0| 6f 76 65 72 20 74 68 65 | 20 65 6e 74 69 72 65 20 |over the| entire |
|000044c0| 51 75 69 63 6b 44 72 61 | 77 20 63 6f 6f 72 64 69 |QuickDra|w coordi|
|000044d0| 6e 61 74 65 20 70 6c 61 | 6e 65 2e 20 49 74 d5 73 |nate pla|ne. It.s|
|000044e0| 20 75 73 75 61 6c 6c 79 | 20 61 20 67 6f 6f 64 20 | usually| a good |
|000044f0| 69 64 65 61 20 74 6f 20 | 73 65 74 20 69 74 20 74 |idea to |set it t|
|00004500| 6f 20 74 68 65 20 73 61 | 6d 65 20 73 69 7a 65 20 |o the sa|me size |
|00004510| 61 6e 64 20 63 6f 6f 72 | 64 69 6e 61 74 65 73 20 |and coor|dinates |
|00004520| 61 73 20 74 68 65 20 70 | 6f 72 74 52 65 63 74 20 |as the p|ortRect |
|00004530| 74 6f 20 61 76 6f 69 64 | 20 70 72 6f 62 6c 65 6d |to avoid| problem|
|00004540| 73 20 69 66 20 74 68 65 | 20 63 6c 69 70 52 67 6e |s if the| clipRgn|
|00004550| 20 69 73 20 73 63 61 6c | 65 64 20 6f 72 20 74 72 | is scal|ed or tr|
|00004560| 61 6e 73 6c 61 74 65 64 | 2c 20 77 68 69 63 68 20 |anslated|, which |
|00004570| 63 61 75 73 65 73 20 69 | 74 73 20 73 69 67 6e 65 |causes i|ts signe|
|00004580| 64 20 69 6e 74 65 67 65 | 72 20 63 6f 6f 72 64 69 |d intege|r coordi|
|00004590| 6e 61 74 65 73 20 74 6f | 20 6f 76 65 72 66 6c 6f |nates to| overflo|
|000045a0| 77 20 61 6e 64 20 74 75 | 72 6e 20 69 74 20 69 6e |w and tu|rn it in|
|000045b0| 74 6f 20 61 6e 20 65 6d | 70 74 79 20 72 65 67 69 |to an em|pty regi|
|000045c0| 6f 6e 2e 20 4f 6e 65 20 | 6f 66 20 74 68 65 20 6d |on. One |of the m|
|000045d0| 6f 73 74 20 63 6f 6d 6d | 6f 6e 20 63 61 73 65 73 |ost comm|on cases|
|000045e0| 20 6f 66 20 74 68 69 73 | 20 6f 63 63 75 72 73 20 | of this| occurs |
|000045f0| 77 68 65 6e 20 61 20 70 | 69 63 74 75 72 65 20 74 |when a p|icture t|
|00004600| 68 61 74 d5 73 20 63 72 | 65 61 74 65 64 20 69 6e |hat.s cr|eated in|
|00004610| 20 74 68 69 73 20 43 47 | 72 61 66 50 6f 72 74 20 | this CG|rafPort |
|00004620| 69 73 20 64 72 61 77 6e | 20 69 6e 74 6f 20 61 20 |is drawn| into a |
|00004630| 64 65 73 74 69 6e 61 74 | 69 6f 6e 20 72 65 63 74 |destinat|ion rect|
|00004640| 61 6e 67 6c 65 20 74 68 | 61 74 d5 73 20 61 6e 79 |angle th|at.s any|
|00004650| 20 6c 61 72 67 65 72 20 | 74 68 61 6e 20 6f 72 20 | larger |than or |
|00004660| 74 72 61 6e 73 6c 61 74 | 65 64 20 66 72 6f 6d 20 |translat|ed from |
|00004670| 74 68 65 20 6f 72 69 67 | 69 6e 61 6c 20 70 69 63 |the orig|inal pic|
|00004680| 74 75 72 65 20 66 72 61 | 6d 65 2e 20 45 76 65 72 |ture fra|me. Ever|
|00004690| 79 74 68 69 6e 67 20 69 | 6e 20 74 68 65 20 70 69 |ything i|n the pi|
|000046a0| 63 74 75 72 65 2c 20 69 | 6e 63 6c 75 64 69 6e 67 |cture, i|ncluding|
|000046b0| 20 74 68 65 20 63 6c 69 | 70 20 72 65 67 69 6f 6e | the cli|p region|
|000046c0| 2c 20 69 73 20 73 63 61 | 6c 65 64 20 74 6f 20 66 |, is sca|led to f|
|000046d0| 69 74 20 74 68 65 20 64 | 65 73 74 69 6e 61 74 69 |it the d|estinati|
|000046e0| 6f 6e 20 72 65 63 74 61 | 6e 67 6c 65 2e 20 49 66 |on recta|ngle. If|
|000046f0| 20 74 68 65 20 63 6c 69 | 70 20 72 65 67 69 6f 6e | the cli|p region|
|00004700| 20 63 6f 76 65 72 73 20 | 74 68 65 20 65 6e 74 69 | covers |the enti|
|00004710| 72 65 20 51 75 69 63 6b | 44 72 61 77 20 63 6f 6f |re Quick|Draw coo|
|00004720| 72 64 69 6e 61 74 65 20 | 70 6c 61 6e 65 2c 20 74 |rdinate |plane, t|
|00004730| 68 65 6e 20 69 74 73 20 | 63 6f 6f 72 64 69 6e 61 |hen its |coordina|
|00004740| 74 65 73 20 6f 76 65 72 | 66 6c 6f 77 20 74 68 65 |tes over|flow the|
|00004750| 69 72 20 73 69 67 6e 65 | 64 20 69 6e 74 65 67 65 |ir signe|d intege|
|00004760| 72 20 62 6f 75 6e 64 73 | 2c 20 61 6e 64 20 74 68 |r bounds|, and th|
|00004770| 65 20 63 6c 69 70 20 72 | 65 67 69 6f 6e 20 62 65 |e clip r|egion be|
|00004780| 63 6f 6d 65 73 20 6c 6f | 67 69 63 61 6c 6c 79 20 |comes lo|gically |
|00004790| 65 6d 70 74 79 2e 20 54 | 68 65 20 72 65 73 75 6c |empty. T|he resul|
|000047a0| 74 20 69 73 20 74 68 61 | 74 20 6e 6f 74 68 69 6e |t is tha|t nothin|
|000047b0| 67 20 69 73 20 64 72 61 | 77 6e 2e 0d 54 68 65 20 |g is dra|wn..The |
|000047c0| 43 72 65 61 74 65 4f 66 | 66 53 63 72 65 65 6e 20 |CreateOf|fScreen |
|000047d0| 72 6f 75 74 69 6e 65 20 | 69 6e 20 4c 69 73 74 69 |routine |in Listi|
|000047e0| 6e 67 20 31 20 63 72 65 | 61 74 65 73 20 61 6e 20 |ng 1 cre|ates an |
|000047f0| 6f 66 66 2d 73 63 72 65 | 65 6e 20 67 72 61 70 68 |off-scre|en graph|
|00004800| 69 63 73 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2c |ics envi|ronment,|
|00004810| 20 67 69 76 65 6e 20 61 | 20 62 6f 75 6e 64 61 72 | given a| boundar|
|00004820| 79 20 72 65 63 74 61 6e | 67 6c 65 2c 20 70 69 78 |y rectan|gle, pix|
|00004830| 65 6c 20 64 65 70 74 68 | 2c 20 61 6e 64 20 63 6f |el depth|, and co|
|00004840| 6c 6f 72 20 74 61 62 6c | 65 2c 20 61 6e 64 20 69 |lor tabl|e, and i|
|00004850| 74 20 72 65 74 75 72 6e | 73 20 61 20 6e 65 77 20 |t return|s a new |
|00004860| 6f 66 66 2d 73 63 72 65 | 65 6e 20 43 47 72 61 66 |off-scre|en CGraf|
|00004870| 50 6f 72 74 20 61 6e 64 | 20 47 44 65 76 69 63 65 |Port and| GDevice|
|00004880| 2c 20 61 6c 6f 6e 67 20 | 77 69 74 68 20 61 6e 20 |, along |with an |
|00004890| 65 72 72 6f 72 20 63 6f | 64 65 2e 20 54 68 65 20 |error co|de. The |
|000048a0| 64 65 73 69 72 65 64 20 | 70 69 78 65 6c 20 64 65 |desired |pixel de|
|000048b0| 70 74 68 20 69 6e 20 62 | 69 74 73 20 70 65 72 20 |pth in b|its per |
|000048c0| 70 69 78 65 6c 20 69 73 | 20 67 69 76 65 6e 20 69 |pixel is| given i|
|000048d0| 6e 20 74 68 65 20 64 65 | 70 74 68 20 70 61 72 61 |n the de|pth para|
|000048e0| 6d 65 74 65 72 2e 20 49 | 66 20 74 68 65 20 70 69 |meter. I|f the pi|
|000048f0| 78 65 6c 20 64 65 70 74 | 68 20 69 73 20 65 69 67 |xel dept|h is eig|
|00004900| 68 74 20 6f 72 20 6c 65 | 73 73 2c 20 74 68 65 6e |ht or le|ss, then|
|00004910| 20 61 6e 20 69 6e 64 65 | 78 65 64 2d 63 6f 6c 6f | an inde|xed-colo|
|00004920| 72 20 67 72 61 70 68 69 | 63 73 20 65 6e 76 69 72 |r graphi|cs envir|
|00004930| 6f 6e 6d 65 6e 74 20 69 | 73 20 63 72 65 61 74 65 |onment i|s create|
|00004940| 64 20 61 6e 64 20 61 20 | 63 6f 6c 6f 72 20 74 61 |d and a |color ta|
|00004950| 62 6c 65 20 69 73 20 72 | 65 71 75 69 72 65 64 20 |ble is r|equired |
|00004960| 69 6e 20 74 68 65 20 63 | 6f 6c 6f 72 73 20 70 61 |in the c|olors pa|
|00004970| 72 61 6d 65 74 65 72 2e | 20 49 66 20 74 68 65 20 |rameter.| If the |
|00004980| 70 69 78 65 6c 20 64 65 | 70 74 68 20 69 73 20 31 |pixel de|pth is 1|
|00004990| 36 20 6f 72 20 33 32 20 | 62 69 74 73 20 70 65 72 |6 or 32 |bits per|
|000049a0| 20 70 69 78 65 6c 20 61 | 6e 64 20 33 32 2d 42 69 | pixel a|nd 32-Bi|
|000049b0| 74 20 51 75 69 63 6b 44 | 72 61 77 20 69 73 20 61 |t QuickD|raw is a|
|000049c0| 76 61 69 6c 61 62 6c 65 | 2c 20 74 68 65 6e 20 61 |vailable|, then a|
|000049d0| 20 64 69 72 65 63 74 2d | 63 6f 6c 6f 72 20 67 72 | direct-|color gr|
|000049e0| 61 70 68 69 63 73 20 65 | 6e 76 69 72 6f 6e 6d 65 |aphics e|nvironme|
|000049f0| 6e 74 20 69 73 20 63 72 | 65 61 74 65 64 20 61 6e |nt is cr|eated an|
|00004a00| 64 20 74 68 65 20 63 6f | 6c 6f 72 73 20 70 61 72 |d the co|lors par|
|00004a10| 61 6d 65 74 65 72 20 69 | 73 20 69 67 6e 6f 72 65 |ameter i|s ignore|
|00004a20| 64 2e 20 49 66 20 33 32 | 2d 42 69 74 20 51 75 69 |d. If 32|-Bit Qui|
|00004a30| 63 6b 44 72 61 77 20 69 | 73 6e d5 74 20 61 76 61 |ckDraw i|sn.t ava|
|00004a40| 69 6c 61 62 6c 65 2c 20 | 74 68 65 6e 20 61 20 70 |ilable, |then a p|
|00004a50| 69 78 65 6c 20 64 65 70 | 74 68 20 6f 66 20 31 36 |ixel dep|th of 16|
|00004a60| 20 6f 72 20 33 32 20 62 | 69 74 73 20 70 65 72 20 | or 32 b|its per |
|00004a70| 70 69 78 65 6c 20 72 65 | 73 75 6c 74 73 20 69 6e |pixel re|sults in|
|00004a80| 20 43 72 65 61 74 65 4f | 66 66 53 63 72 65 65 6e | CreateO|ffScreen|
|00004a90| 20 64 6f 69 6e 67 20 6e | 6f 74 68 69 6e 67 20 6d | doing n|othing m|
|00004aa0| 6f 72 65 20 74 68 61 6e | 20 72 65 74 75 72 6e 69 |ore than| returni|
|00004ab0| 6e 67 20 61 20 70 61 72 | 61 6d 65 74 65 72 20 65 |ng a par|ameter e|
|00004ac0| 72 72 6f 72 2e 20 41 20 | 64 65 73 63 72 69 70 74 |rror. A |descript|
|00004ad0| 69 6f 6e 20 6f 66 20 43 | 72 65 61 74 65 4f 66 66 |ion of C|reateOff|
|00004ae0| 53 63 72 65 65 6e 20 69 | 73 20 67 69 76 65 6e 20 |Screen i|s given |
|00004af0| 66 6f 6c 6c 6f 77 69 6e | 67 20 74 68 65 20 6c 69 |followin|g the li|
|00004b00| 73 74 69 6e 67 2e 0d 4d | 50 57 20 50 61 73 63 61 |sting..M|PW Pasca|
|00004b10| 6c 20 4c 69 73 74 69 6e | 67 20 31 0d 46 55 4e 43 |l Listin|g 1.FUNC|
|00004b20| 54 49 4f 4e 20 43 72 65 | 61 74 65 4f 66 66 53 63 |TION Cre|ateOffSc|
|00004b30| 72 65 65 6e 28 0d 20 20 | 20 62 6f 75 6e 64 73 3a |reen(. | bounds:|
|00004b40| 20 20 20 20 20 20 20 20 | 20 52 65 63 74 3b 20 20 | | Rect; |
|00004b50| 20 20 20 20 20 7b 42 6f | 75 6e 64 69 6e 67 20 72 | {Bo|unding r|
|00004b60| 65 63 74 61 6e 67 6c 65 | 20 6f 66 20 6f 66 66 2d |ectangle| of off-|
|00004b70| 73 63 72 65 65 6e 7d 0d | 20 20 20 64 65 70 74 68 |screen}.| depth|
|00004b80| 3a 20 20 20 20 20 20 20 | 20 20 20 49 6e 74 65 67 |: | Integ|
|00004b90| 65 72 3b 20 20 20 20 7b | 44 65 73 69 72 65 64 20 |er; {|Desired |
|00004ba0| 6e 75 6d 62 65 72 20 6f | 66 20 62 69 74 73 20 70 |number o|f bits p|
|00004bb0| 65 72 20 70 69 78 65 6c | 20 69 6e 20 6f 66 66 2d |er pixel| in off-|
|00004bc0| 73 63 72 65 65 6e 7d 0d | 20 20 20 63 6f 6c 6f 72 |screen}.| color|
|00004bd0| 73 3a 20 20 20 20 20 20 | 20 20 20 43 54 61 62 48 |s: | CTabH|
|00004be0| 61 6e 64 6c 65 3b 20 7b | 43 6f 6c 6f 72 20 74 61 |andle; {|Color ta|
|00004bf0| 62 6c 65 20 74 6f 20 61 | 73 73 69 67 6e 20 74 6f |ble to a|ssign to|
|00004c00| 20 6f 66 66 2d 73 63 72 | 65 65 6e 7d 0d 20 20 20 | off-scr|een}. |
|00004c10| 56 41 52 20 72 65 74 50 | 6f 72 74 3a 20 20 20 20 |VAR retP|ort: |
|00004c20| 43 47 72 61 66 50 74 72 | 3b 20 20 20 7b 52 65 74 |CGrafPtr|; {Ret|
|00004c30| 75 72 6e 73 20 61 20 70 | 6f 69 6e 74 65 72 20 74 |urns a p|ointer t|
|00004c40| 6f 20 74 68 65 20 6e 65 | 77 20 43 47 72 61 66 50 |o the ne|w CGrafP|
|00004c50| 6f 72 74 7d 0d 20 20 20 | 56 41 52 20 72 65 74 47 |ort}. |VAR retG|
|00004c60| 44 65 76 69 63 65 3a 20 | 47 44 48 61 6e 64 6c 65 |Device: |GDHandle|
|00004c70| 20 20 20 20 7b 52 65 74 | 75 72 6e 73 20 61 20 68 | {Ret|urns a h|
|00004c80| 61 6e 64 6c 65 20 74 6f | 20 74 68 65 20 6e 65 77 |andle to| the new|
|00004c90| 20 47 44 65 76 69 63 65 | 7d 0d 20 20 20 29 3a 20 | GDevice|}. ): |
|00004ca0| 4f 53 45 72 72 3b 0d 20 | 20 20 43 4f 4e 53 54 0d |OSErr;. | CONST.|
|00004cb0| 20 20 20 20 20 20 6b 4d | 61 78 52 6f 77 42 79 74 | kM|axRowByt|
|00004cc0| 65 73 20 3d 20 24 33 46 | 46 45 3b 20 7b 4d 61 78 |es = $3F|FE; {Max|
|00004cd0| 69 6d 75 6d 20 6e 75 6d | 62 65 72 20 6f 66 20 62 |imum num|ber of b|
|00004ce0| 79 74 65 73 20 69 6e 20 | 61 20 72 6f 77 20 6f 66 |ytes in |a row of|
|00004cf0| 20 70 69 78 65 6c 73 7d | 0d 20 20 20 56 41 52 0d | pixels}|. VAR.|
|00004d00| 20 20 20 20 20 20 6e 65 | 77 50 6f 72 74 3a 20 20 | ne|wPort: |
|00004d10| 20 20 20 43 47 72 61 66 | 50 74 72 3b 20 20 20 20 | CGraf|Ptr; |
|00004d20| 20 7b 50 6f 69 6e 74 65 | 72 20 74 6f 20 74 68 65 | {Pointe|r to the|
|00004d30| 20 6e 65 77 20 6f 66 66 | 2d 73 63 72 65 65 6e 20 | new off|-screen |
|00004d40| 43 47 72 61 66 50 6f 72 | 74 7d 0d 20 20 20 20 20 |CGrafPor|t}. |
|00004d50| 20 6e 65 77 50 69 78 4d | 61 70 3a 20 20 20 50 69 | newPixM|ap: Pi|
|00004d60| 78 4d 61 70 48 61 6e 64 | 6c 65 3b 20 7b 48 61 6e |xMapHand|le; {Han|
|00004d70| 64 6c 65 20 74 6f 20 74 | 68 65 20 6e 65 77 20 6f |dle to t|he new o|
|00004d80| 66 66 2d 73 63 72 65 65 | 6e 20 50 69 78 4d 61 70 |ff-scree|n PixMap|
|00004d90| 7d 0d 20 20 20 20 20 20 | 6e 65 77 44 65 76 69 63 |}. |newDevic|
|00004da0| 65 3a 20 20 20 47 44 48 | 61 6e 64 6c 65 3b 20 20 |e: GDH|andle; |
|00004db0| 20 20 20 7b 48 61 6e 64 | 6c 65 20 74 6f 20 74 68 | {Hand|le to th|
|00004dc0| 65 20 6e 65 77 20 6f 66 | 66 2d 73 63 72 65 65 6e |e new of|f-screen|
|00004dd0| 20 47 44 65 76 69 63 65 | 7d 0d 20 20 20 20 20 20 | GDevice|}. |
|00004de0| 71 64 56 65 72 73 69 6f | 6e 3a 20 20 20 4c 6f 6e |qdVersio|n: Lon|
|00004df0| 67 49 6e 74 3b 20 20 20 | 20 20 20 7b 56 65 72 73 |gInt; | {Vers|
|00004e00| 69 6f 6e 20 6f 66 20 51 | 75 69 63 6b 44 72 61 77 |ion of Q|uickDraw|
|00004e10| 20 63 75 72 72 65 6e 74 | 6c 79 20 69 6e 20 75 73 | current|ly in us|
|00004e20| 65 7d 0d 20 20 20 20 20 | 20 73 61 76 65 64 50 6f |e}. | savedPo|
|00004e30| 72 74 3a 20 20 20 47 72 | 61 66 50 74 72 3b 20 20 |rt: Gr|afPtr; |
|00004e40| 20 20 20 20 7b 50 6f 69 | 6e 74 65 72 20 74 6f 20 | {Poi|nter to |
|00004e50| 47 72 61 66 50 6f 72 74 | 20 75 73 65 64 20 66 6f |GrafPort| used fo|
|00004e60| 72 20 73 61 76 65 2f 72 | 65 73 74 6f 72 65 7d 0d |r save/r|estore}.|
|00004e70| 20 20 20 20 20 20 73 61 | 76 65 64 53 74 61 74 65 | sa|vedState|
|00004e80| 3a 20 20 53 69 67 6e 65 | 64 42 79 74 65 3b 20 20 |: Signe|dByte; |
|00004e90| 20 7b 53 61 76 65 64 20 | 73 74 61 74 65 20 6f 66 | {Saved |state of|
|00004ea0| 20 63 6f 6c 6f 72 20 74 | 61 62 6c 65 20 68 61 6e | color t|able han|
|00004eb0| 64 6c 65 7d 0d 20 20 20 | 20 20 20 62 79 74 65 73 |dle}. | bytes|
|00004ec0| 50 65 72 52 6f 77 3a 20 | 49 6e 74 65 67 65 72 3b |PerRow: |Integer;|
|00004ed0| 20 20 20 20 20 20 7b 4e | 75 6d 62 65 72 20 6f 66 | {N|umber of|
|00004ee0| 20 62 79 74 65 73 20 70 | 65 72 20 72 6f 77 20 69 | bytes p|er row i|
|00004ef0| 6e 20 74 68 65 20 50 69 | 78 4d 61 70 7d 0d 20 20 |n the Pi|xMap}. |
|00004f00| 20 20 20 20 65 72 72 6f | 72 3a 20 20 20 20 20 20 | erro|r: |
|00004f10| 20 4f 53 45 72 72 3b 20 | 20 20 20 20 20 20 20 7b | OSErr; | {|
|00004f20| 52 65 74 75 72 6e 73 20 | 65 72 72 6f 72 20 63 6f |Returns |error co|
|00004f30| 64 65 7d 0d 42 45 47 49 | 4e 0d 20 20 20 28 2a 20 |de}.BEGI|N. (* |
|00004f40| 49 6e 69 74 69 61 6c 69 | 7a 65 20 61 20 66 65 77 |Initiali|ze a few|
|00004f50| 20 74 68 69 6e 67 73 20 | 62 65 66 6f 72 65 20 77 | things |before w|
|00004f60| 65 20 62 65 67 69 6e 20 | 2a 29 0d 20 20 20 6e 65 |e begin |*). ne|
|00004f70| 77 50 6f 72 74 20 3a 3d | 20 4e 49 4c 3b 0d 20 20 |wPort :=| NIL;. |
|00004f80| 20 6e 65 77 50 69 78 4d | 61 70 20 3a 3d 20 4e 49 | newPixM|ap := NI|
|00004f90| 4c 3b 0d 20 20 20 6e 65 | 77 44 65 76 69 63 65 20 |L;. ne|wDevice |
|00004fa0| 3a 3d 20 4e 49 4c 3b 0d | 20 20 20 65 72 72 6f 72 |:= NIL;.| error|
|00004fb0| 20 3a 3d 20 6e 6f 45 72 | 72 3b 0d 20 20 20 28 2a | := noEr|r;. (*|
|00004fc0| 20 53 61 76 65 20 74 68 | 65 20 63 6f 6c 6f 72 20 | Save th|e color |
|00004fd0| 74 61 62 6c 65 d5 73 20 | 63 75 72 72 65 6e 74 20 |table.s |current |
|00004fe0| 73 74 61 74 65 20 61 6e | 64 20 6d 61 6b 65 20 73 |state an|d make s|
|00004ff0| 75 72 65 20 69 74 20 69 | 73 6e d5 74 20 70 75 72 |ure it i|sn.t pur|
|00005000| 67 65 61 62 6c 65 20 2a | 29 0d 20 20 20 49 46 20 |geable *|). IF |
|00005010| 63 6f 6c 6f 72 73 20 3c | 3e 20 4e 49 4c 20 54 48 |colors <|> NIL TH|
|00005020| 45 4e 0d 20 20 20 20 20 | 20 42 45 47 49 4e 0d 20 |EN. | BEGIN. |
|00005030| 20 20 20 20 20 20 20 20 | 73 61 76 65 64 53 74 61 | |savedSta|
|00005040| 74 65 20 3a 3d 20 48 47 | 65 74 53 74 61 74 65 28 |te := HG|etState(|
|00005050| 48 61 6e 64 6c 65 28 63 | 6f 6c 6f 72 73 29 29 3b |Handle(c|olors));|
|00005060| 0d 20 20 20 20 20 20 20 | 20 20 48 4e 6f 50 75 72 |. | HNoPur|
|00005070| 67 65 28 48 61 6e 64 6c | 65 28 63 6f 6c 6f 72 73 |ge(Handl|e(colors|
|00005080| 29 29 3b 0d 20 20 20 20 | 20 20 45 4e 44 3b 0d 20 |));. | END;. |
|00005090| 20 20 28 2a 20 43 61 6c | 63 75 6c 61 74 65 20 74 | (* Cal|culate t|
|000050a0| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 62 79 74 |he numbe|r of byt|
|000050b0| 65 73 20 70 65 72 20 72 | 6f 77 20 69 6e 20 74 68 |es per r|ow in th|
|000050c0| 65 20 6f 66 66 2d 73 63 | 72 65 65 6e 20 50 69 78 |e off-sc|reen Pix|
|000050d0| 4d 61 70 20 2a 29 0d 20 | 20 20 62 79 74 65 73 50 |Map *). | bytesP|
|000050e0| 65 72 52 6f 77 20 3a 3d | 20 28 28 64 65 70 74 68 |erRow :=| ((depth|
|000050f0| 20 2a 20 28 62 6f 75 6e | 64 73 2e 72 69 67 68 74 | * (boun|ds.right|
|00005100| 20 2d 20 62 6f 75 6e 64 | 73 2e 6c 65 66 74 29 20 | - bound|s.left) |
|00005110| 2b 20 33 31 29 20 44 49 | 56 20 33 32 29 20 2a 20 |+ 31) DI|V 32) * |
|00005120| 34 3b 0d 20 20 20 28 2a | 20 47 65 74 20 74 68 65 |4;. (*| Get the|
|00005130| 20 63 75 72 72 65 6e 74 | 20 51 75 69 63 6b 44 72 | current| QuickDr|
|00005140| 61 77 20 76 65 72 73 69 | 6f 6e 20 2a 29 0d 20 20 |aw versi|on *). |
|00005150| 20 65 72 72 6f 72 20 3a | 3d 20 47 65 73 74 61 6c | error :|= Gestal|
|00005160| 74 28 67 65 73 74 61 6c | 74 51 75 69 63 6b 64 72 |t(gestal|tQuickdr|
|00005170| 61 77 56 65 72 73 69 6f | 6e 2c 20 71 64 56 65 72 |awVersio|n, qdVer|
|00005180| 73 69 6f 6e 29 3b 0d 20 | 20 20 65 72 72 6f 72 20 |sion);. | error |
|00005190| 3a 3d 20 6e 6f 45 72 72 | 3b 0d 20 20 20 28 2a 20 |:= noErr|;. (* |
|000051a0| 4d 61 6b 65 20 73 75 72 | 65 20 64 65 70 74 68 20 |Make sur|e depth |
|000051b0| 69 73 20 69 6e 64 65 78 | 65 64 20 6f 72 20 64 65 |is index|ed or de|
|000051c0| 70 74 68 20 69 73 20 64 | 69 72 65 63 74 20 61 6e |pth is d|irect an|
|000051d0| 64 20 33 32 2d 42 69 74 | 20 51 44 20 69 6e 73 74 |d 32-Bit| QD inst|
|000051e0| 61 6c 6c 65 64 20 2a 29 | 0d 20 20 20 49 46 20 28 |alled *)|. IF (|
|000051f0| 64 65 70 74 68 20 3d 20 | 31 29 20 4f 52 20 28 64 |depth = |1) OR (d|
|00005200| 65 70 74 68 20 3d 20 32 | 29 20 4f 52 20 28 64 65 |epth = 2|) OR (de|
|00005210| 70 74 68 20 3d 20 34 29 | 20 4f 52 20 28 64 65 70 |pth = 4)| OR (dep|
|00005220| 74 68 20 3d 20 38 29 20 | 4f 52 0d 20 20 20 20 20 |th = 8) |OR. |
|00005230| 20 20 20 20 28 28 28 64 | 65 70 74 68 20 3d 20 31 | (((d|epth = 1|
|00005240| 36 29 20 4f 52 20 28 64 | 65 70 74 68 20 3d 20 33 |6) OR (d|epth = 3|
|00005250| 32 29 29 20 41 4e 44 20 | 28 71 64 56 65 72 73 69 |2)) AND |(qdVersi|
|00005260| 6f 6e 20 3e 3d 20 67 65 | 73 74 61 6c 74 33 32 42 |on >= ge|stalt32B|
|00005270| 69 74 51 44 29 29 20 54 | 48 45 4e 0d 20 20 20 20 |itQD)) T|HEN. |
|00005280| 20 20 42 45 47 49 4e 0d | 20 20 20 20 20 20 20 20 | BEGIN.| |
|00005290| 20 28 2a 20 4d 61 78 69 | 6d 75 6d 20 6e 75 6d 62 | (* Maxi|mum numb|
|000052a0| 65 72 20 6f 66 20 62 79 | 74 65 73 20 70 65 72 20 |er of by|tes per |
|000052b0| 72 6f 77 20 69 73 20 31 | 36 2c 33 38 32 3b 20 6d |row is 1|6,382; m|
|000052c0| 61 6b 65 20 73 75 72 65 | 20 77 69 74 68 69 6e 20 |ake sure| within |
|000052d0| 72 61 6e 67 65 20 2a 29 | 0d 20 20 20 20 20 20 20 |range *)|. |
|000052e0| 20 20 49 46 20 62 79 74 | 65 73 50 65 72 52 6f 77 | IF byt|esPerRow|
|000052f0| 20 3c 3d 20 6b 4d 61 78 | 52 6f 77 42 79 74 65 73 | <= kMax|RowBytes|
|00005300| 20 54 48 45 4e 0d 20 20 | 20 20 20 20 20 20 20 20 | THEN. | |
|00005310| 20 20 42 45 47 49 4e 0d | 20 20 20 20 20 20 20 20 | BEGIN.| |
|00005320| 20 20 20 20 20 20 20 28 | 2a 20 4d 61 6b 65 20 73 | (|* Make s|
|00005330| 75 72 65 20 61 20 63 6f | 6c 6f 72 20 74 61 62 6c |ure a co|lor tabl|
|00005340| 65 20 69 73 20 70 72 6f | 76 69 64 65 64 20 69 66 |e is pro|vided if|
|00005350| 20 74 68 65 20 64 65 70 | 74 68 20 69 73 20 69 6e | the dep|th is in|
|00005360| 64 65 78 65 64 20 2a 29 | 0d 20 20 20 20 20 20 20 |dexed *)|. |
|00005370| 20 20 20 20 20 20 20 20 | 49 46 20 64 65 70 74 68 | |IF depth|
|00005380| 20 3c 3d 20 38 20 54 48 | 45 4e 0d 20 20 20 20 20 | <= 8 TH|EN. |
|00005390| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 49 46 20 | | IF |
|000053a0| 63 6f 6c 6f 72 73 20 3d | 20 4e 49 4c 20 54 48 45 |colors =| NIL THE|
|000053b0| 4e 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |N. | |
|000053c0| 20 20 20 20 20 20 20 28 | 2a 20 49 6e 64 65 78 65 | (|* Indexe|
|000053d0| 64 20 64 65 70 74 68 20 | 61 6e 64 20 63 6c 75 74 |d depth |and clut|
|000053e0| 20 69 73 20 4e 49 4c 3b | 20 69 73 20 70 61 72 61 | is NIL;| is para|
|000053f0| 6d 65 74 65 72 20 65 72 | 72 6f 72 20 2a 29 0d 20 |meter er|ror *). |
|00005400| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005410| 20 20 20 20 65 72 72 6f | 72 20 3a 3d 20 70 61 72 | erro|r := par|
|00005420| 61 6d 45 72 72 3b 0d 20 | 20 20 20 20 20 20 20 20 |amErr;. | |
|00005430| 20 20 20 45 4e 44 0d 20 | 20 20 20 20 20 20 20 20 | END. | |
|00005440| 45 4c 53 45 0d 20 20 20 | 20 20 20 20 20 20 20 20 |ELSE. | |
|00005450| 20 28 2a 20 23 20 6f 66 | 20 62 79 74 65 73 20 70 | (* # of| bytes p|
|00005460| 65 72 20 72 6f 77 20 69 | 73 20 6d 6f 72 65 20 74 |er row i|s more t|
|00005470| 68 61 6e 20 31 36 2c 33 | 38 32 3b 20 69 73 20 70 |han 16,3|82; is p|
|00005480| 61 72 61 6d 65 74 65 72 | 20 65 72 72 6f 72 20 2a |arameter| error *|
|00005490| 29 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 65 72 |). | er|
|000054a0| 72 6f 72 20 3a 3d 20 70 | 61 72 61 6d 45 72 72 3b |ror := p|aramErr;|
|000054b0| 0d 20 20 20 20 20 20 45 | 4e 44 0d 20 20 20 45 4c |. E|ND. EL|
|000054c0| 53 45 0d 20 20 20 20 20 | 20 28 2a 20 50 69 78 65 |SE. | (* Pixe|
|000054d0| 6c 20 64 65 70 74 68 20 | 69 73 6e d5 74 20 76 61 |l depth |isn.t va|
|000054e0| 6c 69 64 3b 20 69 73 20 | 70 61 72 61 6d 65 74 65 |lid; is |paramete|
|000054f0| 72 20 65 72 72 6f 72 20 | 2a 29 0d 20 20 20 20 20 |r error |*). |
|00005500| 20 65 72 72 6f 72 20 3a | 3d 20 70 61 72 61 6d 45 | error :|= paramE|
|00005510| 72 72 3b 0d 20 20 20 28 | 2a 20 49 66 20 73 61 6e |rr;. (|* If san|
|00005520| 69 74 79 20 63 68 65 63 | 6b 73 20 73 75 63 63 65 |ity chec|ks succe|
|00005530| 65 64 2c 20 74 68 65 6e | 20 61 6c 6c 6f 63 61 74 |ed, then| allocat|
|00005540| 65 20 61 20 6e 65 77 20 | 43 47 72 61 66 50 6f 72 |e a new |CGrafPor|
|00005550| 74 20 2a 29 0d 20 20 20 | 49 46 20 65 72 72 6f 72 |t *). |IF error|
|00005560| 20 3d 20 6e 6f 45 72 72 | 20 54 48 45 4e 0d 20 20 | = noErr| THEN. |
|00005570| 20 20 20 20 42 45 47 49 | 4e 0d 20 20 20 20 20 20 | BEGI|N. |
|00005580| 20 20 20 6e 65 77 50 6f | 72 74 20 3a 3d 20 43 47 | newPo|rt := CG|
|00005590| 72 61 66 50 74 72 28 4e | 65 77 50 74 72 28 53 69 |rafPtr(N|ewPtr(Si|
|000055a0| 7a 65 4f 66 20 28 43 47 | 72 61 66 50 6f 72 74 29 |zeOf (CG|rafPort)|
|000055b0| 29 29 3b 0d 20 20 20 20 | 20 20 20 20 20 49 46 20 |));. | IF |
|000055c0| 6e 65 77 50 6f 72 74 20 | 3c 3e 20 4e 49 4c 20 54 |newPort |<> NIL T|
|000055d0| 48 45 4e 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |HEN. | |
|000055e0| 42 45 47 49 4e 0d 20 20 | 20 20 20 20 20 20 20 20 |BEGIN. | |
|000055f0| 20 20 20 20 20 28 2a 20 | 53 61 76 65 20 74 68 65 | (* |Save the|
|00005600| 20 63 75 72 72 65 6e 74 | 20 70 6f 72 74 20 2a 29 | current| port *)|
|00005610| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00005620| 47 65 74 50 6f 72 74 28 | 73 61 76 65 64 50 6f 72 |GetPort(|savedPor|
|00005630| 74 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |t);. | |
|00005640| 20 20 20 28 2a 20 49 6e | 69 74 69 61 6c 69 7a 65 | (* In|itialize|
|00005650| 20 74 68 65 20 6e 65 77 | 20 43 47 72 61 66 50 6f | the new| CGrafPo|
|00005660| 72 74 20 61 6e 64 20 6d | 61 6b 65 20 69 74 20 74 |rt and m|ake it t|
|00005670| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 72 74 20 |he curre|nt port |
|00005680| 2a 29 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |*). | |
|00005690| 20 20 4f 70 65 6e 43 50 | 6f 72 74 28 6e 65 77 50 | OpenCP|ort(newP|
|000056a0| 6f 72 74 29 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |ort);. | |
|000056b0| 20 20 20 20 20 28 2a 20 | 53 65 74 20 70 6f 72 74 | (* |Set port|
|000056c0| 52 65 63 74 2c 20 76 69 | 73 52 67 6e 2c 20 61 6e |Rect, vi|sRgn, an|
|000056d0| 64 20 63 6c 69 70 52 67 | 6e 20 74 6f 20 74 68 65 |d clipRg|n to the|
|000056e0| 20 67 69 76 65 6e 20 62 | 6f 75 6e 64 73 20 72 65 | given b|ounds re|
|000056f0| 63 74 20 2a 29 0d 20 20 | 20 20 20 20 20 20 20 20 |ct *). | |
|00005700| 20 20 20 20 20 6e 65 77 | 50 6f 72 74 5e 2e 70 6f | new|Port^.po|
|00005710| 72 74 52 65 63 74 20 3a | 3d 20 62 6f 75 6e 64 73 |rtRect :|= bounds|
|00005720| 3b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;. | |
|00005730| 20 52 65 63 74 52 67 6e | 28 6e 65 77 50 6f 72 74 | RectRgn|(newPort|
|00005740| 5e 2e 76 69 73 52 67 6e | 2c 20 62 6f 75 6e 64 73 |^.visRgn|, bounds|
|00005750| 29 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |);. | |
|00005760| 20 20 43 6c 69 70 52 65 | 63 74 28 62 6f 75 6e 64 | ClipRe|ct(bound|
|00005770| 73 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |s);. | |
|00005780| 20 20 20 28 2a 20 49 6e | 69 74 69 61 6c 69 7a 65 | (* In|itialize|
|00005790| 20 74 68 65 20 6e 65 77 | 20 50 69 78 4d 61 70 20 | the new| PixMap |
|000057a0| 66 6f 72 20 6f 66 66 2d | 73 63 72 65 65 6e 20 64 |for off-|screen d|
|000057b0| 72 61 77 69 6e 67 20 2a | 29 0d 20 20 20 20 20 20 |rawing *|). |
|000057c0| 20 20 20 20 20 20 20 20 | 20 65 72 72 6f 72 20 3a | | error :|
|000057d0| 3d 20 53 65 74 55 70 50 | 69 78 4d 61 70 28 64 65 |= SetUpP|ixMap(de|
|000057e0| 70 74 68 2c 20 62 6f 75 | 6e 64 73 2c 20 63 6f 6c |pth, bou|nds, col|
|000057f0| 6f 72 73 2c 20 62 79 74 | 65 73 50 65 72 52 6f 77 |ors, byt|esPerRow|
|00005800| 2c 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,. | |
|00005810| 20 20 20 20 20 20 20 6e | 65 77 50 6f 72 74 5e 2e | n|ewPort^.|
|00005820| 70 6f 72 74 50 69 78 4d | 61 70 29 3b 0d 20 20 20 |portPixM|ap);. |
|00005830| 20 20 20 20 20 20 20 20 | 20 20 20 20 49 46 20 65 | | IF e|
|00005840| 72 72 6f 72 20 3d 20 6e | 6f 45 72 72 20 54 48 45 |rror = n|oErr THE|
|00005850| 4e 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |N. | |
|00005860| 20 20 20 20 42 45 47 49 | 4e 0d 20 20 20 20 20 20 | BEGI|N. |
|00005870| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 28 | | (|
|00005880| 2a 20 47 72 61 62 20 74 | 68 65 20 69 6e 69 74 69 |* Grab t|he initi|
|00005890| 61 6c 69 7a 65 64 20 50 | 69 78 4d 61 70 20 68 61 |alized P|ixMap ha|
|000058a0| 6e 64 6c 65 20 2a 29 0d | 20 20 20 20 20 20 20 20 |ndle *).| |
|000058b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6e 65 77 | | new|
|000058c0| 50 69 78 4d 61 70 20 3a | 3d 20 6e 65 77 50 6f 72 |PixMap :|= newPor|
|000058d0| 74 5e 2e 70 6f 72 74 50 | 69 78 4d 61 70 3b 0d 20 |t^.portP|ixMap;. |
|000058e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000058f0| 20 20 20 20 28 2a 20 41 | 6c 6c 6f 63 61 74 65 20 | (* A|llocate |
|00005900| 61 6e 64 20 69 6e 69 74 | 69 61 6c 69 7a 65 20 61 |and init|ialize a|
|00005910| 20 6e 65 77 20 47 44 65 | 76 69 63 65 20 2a 29 0d | new GDe|vice *).|
|00005920| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005930| 20 20 20 20 20 65 72 72 | 6f 72 20 3a 3d 20 43 72 | err|or := Cr|
|00005940| 65 61 74 65 47 44 65 76 | 69 63 65 28 6e 65 77 50 |eateGDev|ice(newP|
|00005950| 69 78 4d 61 70 2c 20 6e | 65 77 44 65 76 69 63 65 |ixMap, n|ewDevice|
|00005960| 29 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |);. | |
|00005970| 20 20 20 20 20 45 4e 44 | 3b 0d 20 20 20 20 20 20 | END|;. |
|00005980| 20 20 20 20 20 20 20 20 | 20 28 2a 20 52 65 73 74 | | (* Rest|
|00005990| 6f 72 65 20 74 68 65 20 | 73 61 76 65 64 20 70 6f |ore the |saved po|
|000059a0| 72 74 20 2a 29 0d 20 20 | 20 20 20 20 20 20 20 20 |rt *). | |
|000059b0| 20 20 20 20 20 53 65 74 | 50 6f 72 74 28 73 61 76 | Set|Port(sav|
|000059c0| 65 64 50 6f 72 74 29 3b | 0d 20 20 20 20 20 20 20 |edPort);|. |
|000059d0| 20 20 20 20 20 45 4e 44 | 0d 20 20 20 20 20 20 20 | END|. |
|000059e0| 20 20 45 4c 53 45 0d 20 | 20 20 20 20 20 20 20 20 | ELSE. | |
|000059f0| 20 20 20 65 72 72 6f 72 | 20 3a 3d 20 4d 65 6d 45 | error| := MemE|
|00005a00| 72 72 6f 72 3b 0d 20 20 | 20 20 20 20 45 4e 44 3b |rror;. | END;|
|00005a10| 0d 20 20 20 28 2a 20 52 | 65 73 74 6f 72 65 20 74 |. (* R|estore t|
|00005a20| 68 65 20 67 69 76 65 6e | 20 73 74 61 74 65 20 6f |he given| state o|
|00005a30| 66 20 74 68 65 20 63 6f | 6c 6f 72 20 74 61 62 6c |f the co|lor tabl|
|00005a40| 65 20 2a 29 0d 20 20 20 | 49 46 20 63 6f 6c 6f 72 |e *). |IF color|
|00005a50| 73 20 3c 3e 20 4e 49 4c | 20 54 48 45 4e 0d 20 20 |s <> NIL| THEN. |
|00005a60| 20 20 20 20 48 53 65 74 | 53 74 61 74 65 28 48 61 | HSet|State(Ha|
|00005a70| 6e 64 6c 65 28 63 6f 6c | 6f 72 73 29 2c 20 73 61 |ndle(col|ors), sa|
|00005a80| 76 65 64 53 74 61 74 65 | 29 3b 0d 20 20 20 28 2a |vedState|);. (*|
|00005a90| 20 4f 6e 65 20 4c 61 73 | 74 20 4c 6f 6f 6b 20 41 | One Las|t Look A|
|00005aa0| 72 6f 75 6e 64 20 54 68 | 65 20 48 6f 75 73 65 20 |round Th|e House |
|00005ab0| 42 65 66 6f 72 65 20 57 | 65 20 47 6f c9 20 2a 29 |Before W|e Go. *)|
|00005ac0| 0d 20 20 20 49 46 20 65 | 72 72 6f 72 20 3c 3e 20 |. IF e|rror <> |
|00005ad0| 6e 6f 45 72 72 20 54 48 | 45 4e 0d 20 20 20 20 20 |noErr TH|EN. |
|00005ae0| 20 42 45 47 49 4e 0d 20 | 20 20 20 20 20 20 20 20 | BEGIN. | |
|00005af0| 28 2a 20 53 6f 6d 65 20 | 65 72 72 6f 72 20 6f 63 |(* Some |error oc|
|00005b00| 63 75 72 72 65 64 3b 20 | 64 69 73 70 6f 73 65 20 |curred; |dispose |
|00005b10| 6f 66 20 65 76 65 72 79 | 74 68 69 6e 67 20 77 65 |of every|thing we|
|00005b20| 20 61 6c 6c 6f 63 61 74 | 65 64 20 2a 29 0d 20 20 | allocat|ed *). |
|00005b30| 20 20 20 20 20 20 20 49 | 46 20 6e 65 77 50 69 78 | I|F newPix|
|00005b40| 4d 61 70 20 3c 3e 20 4e | 49 4c 20 54 48 45 4e 0d |Map <> N|IL THEN.|
|00005b50| 20 20 20 20 20 20 20 20 | 20 20 20 20 42 45 47 49 | | BEGI|
|00005b60| 4e 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |N. | |
|00005b70| 20 44 69 73 70 6f 73 43 | 54 61 62 6c 65 28 6e 65 | DisposC|Table(ne|
|00005b80| 77 50 69 78 4d 61 70 5e | 5e 2e 70 6d 54 61 62 6c |wPixMap^|^.pmTabl|
|00005b90| 65 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |e);. | |
|00005ba0| 20 20 20 44 69 73 70 6f | 73 50 74 72 28 6e 65 77 | Dispo|sPtr(new|
|00005bb0| 50 69 78 4d 61 70 5e 5e | 2e 62 61 73 65 41 64 64 |PixMap^^|.baseAdd|
|00005bc0| 72 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |r);. | |
|00005bd0| 45 4e 44 3b 0d 20 20 20 | 20 20 20 20 20 20 49 46 |END;. | IF|
|00005be0| 20 6e 65 77 44 65 76 69 | 63 65 20 3c 3e 20 4e 49 | newDevi|ce <> NI|
|00005bf0| 4c 20 54 48 45 4e 0d 20 | 20 20 20 20 20 20 20 20 |L THEN. | |
|00005c00| 20 20 20 42 45 47 49 4e | 0d 20 20 20 20 20 20 20 | BEGIN|. |
|00005c10| 20 20 20 20 20 20 20 20 | 44 69 73 70 6f 73 48 61 | |DisposHa|
|00005c20| 6e 64 6c 65 28 48 61 6e | 64 6c 65 28 6e 65 77 44 |ndle(Han|dle(newD|
|00005c30| 65 76 69 63 65 5e 5e 2e | 67 64 49 54 61 62 6c 65 |evice^^.|gdITable|
|00005c40| 29 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |));. | |
|00005c50| 20 20 20 44 69 73 70 6f | 73 48 61 6e 64 6c 65 28 | Dispo|sHandle(|
|00005c60| 48 61 6e 64 6c 65 28 6e | 65 77 44 65 76 69 63 65 |Handle(n|ewDevice|
|00005c70| 29 29 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |));. | |
|00005c80| 45 4e 44 3b 0d 20 20 20 | 20 20 20 20 20 20 49 46 |END;. | IF|
|00005c90| 20 6e 65 77 50 6f 72 74 | 20 3c 3e 20 4e 49 4c 20 | newPort| <> NIL |
|00005ca0| 54 48 45 4e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |THEN. | |
|00005cb0| 20 42 45 47 49 4e 0d 20 | 20 20 20 20 20 20 20 20 | BEGIN. | |
|00005cc0| 20 20 20 20 20 20 43 6c | 6f 73 65 43 50 6f 72 74 | Cl|oseCPort|
|00005cd0| 28 6e 65 77 50 6f 72 74 | 29 3b 0d 20 20 20 20 20 |(newPort|);. |
|00005ce0| 20 20 20 20 20 20 20 20 | 20 20 44 69 73 70 6f 73 | | Dispos|
|00005cf0| 50 74 72 28 50 74 72 28 | 6e 65 77 50 6f 72 74 29 |Ptr(Ptr(|newPort)|
|00005d00| 29 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 45 |);. | E|
|00005d10| 4e 44 3b 0d 20 20 20 20 | 20 20 45 4e 44 0d 20 20 |ND;. | END. |
|00005d20| 20 45 4c 53 45 0d 20 20 | 20 20 20 20 42 45 47 49 | ELSE. | BEGI|
|00005d30| 4e 0d 20 20 20 20 20 20 | 20 20 20 28 2a 20 45 76 |N. | (* Ev|
|00005d40| 65 72 79 74 68 69 6e 67 | d5 73 20 4f 4b 3b 20 72 |erything|.s OK; r|
|00005d50| 65 74 75 72 6e 20 72 65 | 66 73 20 74 6f 20 6f 66 |eturn re|fs to of|
|00005d60| 66 2d 73 63 72 65 65 6e | 20 43 47 72 61 66 50 6f |f-screen| CGrafPo|
|00005d70| 72 74 20 61 6e 64 20 47 | 44 65 76 69 63 65 20 2a |rt and G|Device *|
|00005d80| 29 0d 20 20 20 20 20 20 | 20 20 20 72 65 74 50 6f |). | retPo|
|00005d90| 72 74 20 3a 3d 20 6e 65 | 77 50 6f 72 74 3b 0d 20 |rt := ne|wPort;. |
|00005da0| 20 20 20 20 20 20 20 20 | 72 65 74 47 44 65 76 69 | |retGDevi|
|00005db0| 63 65 20 3a 3d 20 6e 65 | 77 44 65 76 69 63 65 3b |ce := ne|wDevice;|
|00005dc0| 0d 20 20 20 20 20 20 45 | 4e 44 3b 0d 20 20 20 43 |. E|ND;. C|
|00005dd0| 72 65 61 74 65 4f 66 66 | 53 63 72 65 65 6e 20 3a |reateOff|Screen :|
|00005de0| 3d 20 65 72 72 6f 72 3b | 0d 45 4e 44 3b 0d 4d 50 |= error;|.END;.MP|
|00005df0| 57 20 43 20 4c 69 73 74 | 69 6e 67 20 31 0d 23 64 |W C List|ing 1.#d|
|00005e00| 65 66 69 6e 65 20 6b 4d | 61 78 52 6f 77 42 79 74 |efine kM|axRowByt|
|00005e10| 65 73 20 30 78 33 46 46 | 45 20 2f 2a 20 4d 61 78 |es 0x3FF|E /* Max|
|00005e20| 69 6d 75 6d 20 6e 75 6d | 62 65 72 20 6f 66 20 62 |imum num|ber of b|
|00005e30| 79 74 65 73 20 69 6e 20 | 61 20 72 6f 77 20 6f 66 |ytes in |a row of|
|00005e40| 20 70 69 78 65 6c 73 20 | 2a 2f 0d 4f 53 45 72 72 | pixels |*/.OSErr|
|00005e50| 20 43 72 65 61 74 65 4f | 66 66 53 63 72 65 65 6e | CreateO|ffScreen|
|00005e60| 28 0d 20 20 20 20 52 65 | 63 74 20 20 20 20 20 20 |(. Re|ct |
|00005e70| 20 2a 62 6f 75 6e 64 73 | 2c 20 20 20 20 20 2f 2a | *bounds|, /*|
|00005e80| 20 42 6f 75 6e 64 69 6e | 67 20 72 65 63 74 61 6e | Boundin|g rectan|
|00005e90| 67 6c 65 20 6f 66 20 6f | 66 66 2d 73 63 72 65 65 |gle of o|ff-scree|
|00005ea0| 6e 20 2a 2f 0d 20 20 20 | 20 73 68 6f 72 74 20 20 |n */. | short |
|00005eb0| 20 20 20 20 64 65 70 74 | 68 2c 20 20 20 20 20 20 | dept|h, |
|00005ec0| 20 2f 2a 20 44 65 73 69 | 72 65 64 20 6e 75 6d 62 | /* Desi|red numb|
|00005ed0| 65 72 20 6f 66 20 62 69 | 74 73 20 70 65 72 20 70 |er of bi|ts per p|
|00005ee0| 69 78 65 6c 20 69 6e 20 | 6f 66 66 2d 73 63 72 65 |ixel in |off-scre|
|00005ef0| 65 6e 20 2a 2f 0d 20 20 | 20 20 43 54 61 62 48 61 |en */. | CTabHa|
|00005f00| 6e 64 6c 65 20 63 6f 6c | 6f 72 73 2c 20 20 20 20 |ndle col|ors, |
|00005f10| 20 20 2f 2a 20 43 6f 6c | 6f 72 20 74 61 62 6c 65 | /* Col|or table|
|00005f20| 20 74 6f 20 61 73 73 69 | 67 6e 20 74 6f 20 6f 66 | to assi|gn to of|
|00005f30| 66 2d 73 63 72 65 65 6e | 20 2a 2f 0d 20 20 20 20 |f-screen| */. |
|00005f40| 43 47 72 61 66 50 74 72 | 20 20 20 2a 72 65 74 50 |CGrafPtr| *retP|
|00005f50| 6f 72 74 2c 20 20 20 20 | 2f 2a 20 52 65 74 75 72 |ort, |/* Retur|
|00005f60| 6e 73 20 61 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |ns a poi|nter to |
|00005f70| 74 68 65 20 6e 65 77 20 | 43 47 72 61 66 50 6f 72 |the new |CGrafPor|
|00005f80| 74 20 2a 2f 0d 20 20 20 | 20 47 44 48 61 6e 64 6c |t */. | GDHandl|
|00005f90| 65 20 20 20 2a 72 65 74 | 47 44 65 76 69 63 65 29 |e *ret|GDevice)|
|00005fa0| 20 2f 2a 20 52 65 74 75 | 72 6e 73 20 61 20 68 61 | /* Retu|rns a ha|
|00005fb0| 6e 64 6c 65 20 74 6f 20 | 74 68 65 20 6e 65 77 20 |ndle to |the new |
|00005fc0| 47 44 65 76 69 63 65 20 | 2a 2f 0d 7b 0d 20 20 20 |GDevice |*/.{. |
|00005fd0| 20 43 47 72 61 66 50 74 | 72 20 20 20 20 20 6e 65 | CGrafPt|r ne|
|00005fe0| 77 50 6f 72 74 3b 20 20 | 20 20 20 2f 2a 20 50 6f |wPort; | /* Po|
|00005ff0| 69 6e 74 65 72 20 74 6f | 20 74 68 65 20 6e 65 77 |inter to| the new|
|00006000| 20 6f 66 66 2d 73 63 72 | 65 65 6e 20 43 47 72 61 | off-scr|een CGra|
|00006010| 66 50 6f 72 74 20 2a 2f | 0d 20 20 20 20 50 69 78 |fPort */|. Pix|
|00006020| 4d 61 70 48 61 6e 64 6c | 65 20 6e 65 77 50 69 78 |MapHandl|e newPix|
|00006030| 4d 61 70 3b 20 20 20 2f | 2a 20 48 61 6e 64 6c 65 |Map; /|* Handle|
|00006040| 20 74 6f 20 74 68 65 20 | 6e 65 77 20 6f 66 66 2d | to the |new off-|
|00006050| 73 63 72 65 65 6e 20 50 | 69 78 4d 61 70 20 2a 2f |screen P|ixMap */|
|00006060| 0d 20 20 20 20 47 44 48 | 61 6e 64 6c 65 20 20 20 |. GDH|andle |
|00006070| 20 20 6e 65 77 44 65 76 | 69 63 65 3b 20 20 20 2f | newDev|ice; /|
|00006080| 2a 20 48 61 6e 64 6c 65 | 20 74 6f 20 74 68 65 20 |* Handle| to the |
|00006090| 6e 65 77 20 6f 66 66 2d | 73 63 72 65 65 6e 20 47 |new off-|screen G|
|000060a0| 44 65 76 69 63 65 20 2a | 2f 0d 20 20 20 20 6c 6f |Device *|/. lo|
|000060b0| 6e 67 20 20 20 20 20 20 | 20 20 20 71 64 56 65 72 |ng | qdVer|
|000060c0| 73 69 6f 6e 3b 20 20 20 | 2f 2a 20 56 65 72 73 69 |sion; |/* Versi|
|000060d0| 6f 6e 20 6f 66 20 51 75 | 69 63 6b 44 72 61 77 20 |on of Qu|ickDraw |
|000060e0| 63 75 72 72 65 6e 74 6c | 79 20 69 6e 20 75 73 65 |currentl|y in use|
|000060f0| 20 2a 2f 0d 20 20 20 20 | 47 72 61 66 50 74 72 20 | */. |GrafPtr |
|00006100| 20 20 20 20 20 73 61 76 | 65 64 50 6f 72 74 3b 20 | sav|edPort; |
|00006110| 20 20 2f 2a 20 50 6f 69 | 6e 74 65 72 20 74 6f 20 | /* Poi|nter to |
|00006120| 47 72 61 66 50 6f 72 74 | 20 75 73 65 64 20 66 6f |GrafPort| used fo|
|00006130| 72 20 73 61 76 65 2f 72 | 65 73 74 6f 72 65 20 2a |r save/r|estore *|
|00006140| 2f 0d 20 20 20 20 53 69 | 67 6e 65 64 42 79 74 65 |/. Si|gnedByte|
|00006150| 20 20 20 73 61 76 65 64 | 53 74 61 74 65 3b 20 20 | saved|State; |
|00006160| 2f 2a 20 53 61 76 65 64 | 20 73 74 61 74 65 20 6f |/* Saved| state o|
|00006170| 66 20 63 6f 6c 6f 72 20 | 74 61 62 6c 65 20 68 61 |f color |table ha|
|00006180| 6e 64 6c 65 20 2a 2f 0d | 20 20 20 20 73 68 6f 72 |ndle */.| shor|
|00006190| 74 20 20 20 20 20 20 20 | 20 62 79 74 65 73 50 65 |t | bytesPe|
|000061a0| 72 52 6f 77 3b 20 2f 2a | 20 4e 75 6d 62 65 72 20 |rRow; /*| Number |
|000061b0| 6f 66 20 62 79 74 65 73 | 20 70 65 72 20 72 6f 77 |of bytes| per row|
|000061c0| 20 69 6e 20 74 68 65 20 | 50 69 78 4d 61 70 20 2a | in the |PixMap *|
|000061d0| 2f 0d 20 20 20 20 4f 53 | 45 72 72 20 20 20 20 20 |/. OS|Err |
|000061e0| 20 20 20 65 72 72 6f 72 | 3b 20 20 20 20 20 20 20 | error|; |
|000061f0| 2f 2a 20 52 65 74 75 72 | 6e 73 20 65 72 72 6f 72 |/* Retur|ns error|
|00006200| 20 63 6f 64 65 20 2a 2f | 0d 20 20 20 20 2f 2a 20 | code */|. /* |
|00006210| 49 6e 69 74 69 61 6c 69 | 7a 65 20 61 20 66 65 77 |Initiali|ze a few|
|00006220| 20 74 68 69 6e 67 73 20 | 62 65 66 6f 72 65 20 77 | things |before w|
|00006230| 65 20 62 65 67 69 6e 20 | 2a 2f 0d 20 20 20 20 6e |e begin |*/. n|
|00006240| 65 77 50 6f 72 74 20 3d | 20 6e 69 6c 3b 0d 20 20 |ewPort =| nil;. |
|00006250| 20 20 6e 65 77 50 69 78 | 4d 61 70 20 3d 20 6e 69 | newPix|Map = ni|
|00006260| 6c 3b 0d 20 20 20 20 6e | 65 77 44 65 76 69 63 65 |l;. n|ewDevice|
|00006270| 20 3d 20 6e 69 6c 3b 0d | 20 20 20 20 65 72 72 6f | = nil;.| erro|
|00006280| 72 20 3d 20 6e 6f 45 72 | 72 3b 0d 20 20 20 20 2f |r = noEr|r;. /|
|00006290| 2a 20 53 61 76 65 20 74 | 68 65 20 63 6f 6c 6f 72 |* Save t|he color|
|000062a0| 20 74 61 62 6c 65 d5 73 | 20 63 75 72 72 65 6e 74 | table.s| current|
|000062b0| 20 73 74 61 74 65 20 61 | 6e 64 20 6d 61 6b 65 20 | state a|nd make |
|000062c0| 73 75 72 65 20 69 74 20 | 69 73 6e d5 74 20 70 75 |sure it |isn.t pu|
|000062d0| 72 67 65 61 62 6c 65 20 | 2a 2f 0d 20 20 20 20 69 |rgeable |*/. i|
|000062e0| 66 20 28 63 6f 6c 6f 72 | 73 20 21 3d 20 6e 69 6c |f (color|s != nil|
|000062f0| 29 0d 20 20 20 20 7b 0d | 20 20 20 20 20 20 20 20 |). {.| |
|00006300| 73 61 76 65 64 53 74 61 | 74 65 20 3d 20 48 47 65 |savedSta|te = HGe|
|00006310| 74 53 74 61 74 65 28 20 | 28 48 61 6e 64 6c 65 29 |tState( |(Handle)|
|00006320| 63 6f 6c 6f 72 73 20 29 | 3b 0d 20 20 20 20 20 20 |colors )|;. |
|00006330| 20 20 48 4e 6f 50 75 72 | 67 65 28 20 28 48 61 6e | HNoPur|ge( (Han|
|00006340| 64 6c 65 29 63 6f 6c 6f | 72 73 20 29 3b 0d 20 20 |dle)colo|rs );. |
|00006350| 20 20 7d 0d 20 20 20 20 | 2f 2a 20 43 61 6c 63 75 | }. |/* Calcu|
|00006360| 6c 61 74 65 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |late the| number |
|00006370| 6f 66 20 62 79 74 65 73 | 20 70 65 72 20 72 6f 77 |of bytes| per row|
|00006380| 20 69 6e 20 74 68 65 20 | 6f 66 66 2d 73 63 72 65 | in the |off-scre|
|00006390| 65 6e 20 50 69 78 4d 61 | 70 20 2a 2f 0d 20 20 20 |en PixMa|p */. |
|000063a0| 20 62 79 74 65 73 50 65 | 72 52 6f 77 20 3d 20 28 | bytesPe|rRow = (|
|000063b0| 28 64 65 70 74 68 20 2a | 20 28 62 6f 75 6e 64 73 |(depth *| (bounds|
|000063c0| 2d 3e 72 69 67 68 74 20 | 2d 20 62 6f 75 6e 64 73 |->right |- bounds|
|000063d0| 2d 3e 6c 65 66 74 29 20 | 2b 20 33 31 29 20 3e 3e |->left) |+ 31) >>|
|000063e0| 20 35 29 20 3c 3c 20 32 | 3b 0d 20 20 20 20 2f 2a | 5) << 2|;. /*|
|000063f0| 20 47 65 74 20 74 68 65 | 20 63 75 72 72 65 6e 74 | Get the| current|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.